diff options
35 files changed, 8138 insertions, 3663 deletions
diff --git a/Documentation/networking/README.ipw2100 b/Documentation/networking/README.ipw2100 index 2046948b020d..3ab40379d1cf 100644 --- a/Documentation/networking/README.ipw2100 +++ b/Documentation/networking/README.ipw2100 | |||
@@ -1,27 +1,82 @@ | |||
1 | 1 | ||
2 | =========================== | 2 | Intel(R) PRO/Wireless 2100 Driver for Linux in support of: |
3 | Intel(R) PRO/Wireless 2100 Network Connection Driver for Linux | 3 | |
4 | Intel(R) PRO/Wireless 2100 Network Connection | ||
5 | |||
6 | Copyright (C) 2003-2005, Intel Corporation | ||
7 | |||
4 | README.ipw2100 | 8 | README.ipw2100 |
5 | 9 | ||
6 | March 14, 2005 | 10 | Version: 1.1.3 |
11 | Date : October 17, 2005 | ||
7 | 12 | ||
8 | =========================== | ||
9 | Index | 13 | Index |
10 | --------------------------- | 14 | ----------------------------------------------- |
11 | 0. Introduction | 15 | 0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER |
12 | 1. Release 1.1.0 Current Features | 16 | 1. Introduction |
13 | 2. Command Line Parameters | 17 | 2. Release 1.1.3 Current Features |
14 | 3. Sysfs Helper Files | 18 | 3. Command Line Parameters |
15 | 4. Radio Kill Switch | 19 | 4. Sysfs Helper Files |
16 | 5. Dynamic Firmware | 20 | 5. Radio Kill Switch |
17 | 6. Power Management | 21 | 6. Dynamic Firmware |
18 | 7. Support | 22 | 7. Power Management |
19 | 8. License | 23 | 8. Support |
20 | 24 | 9. License | |
21 | 25 | ||
22 | =========================== | 26 | |
23 | 0. Introduction | 27 | 0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER |
24 | ------------ ----- ----- ---- --- -- - | 28 | ----------------------------------------------- |
29 | |||
30 | Important Notice FOR ALL USERS OR DISTRIBUTORS!!!! | ||
31 | |||
32 | Intel wireless LAN adapters are engineered, manufactured, tested, and | ||
33 | quality checked to ensure that they meet all necessary local and | ||
34 | governmental regulatory agency requirements for the regions that they | ||
35 | are designated and/or marked to ship into. Since wireless LANs are | ||
36 | generally unlicensed devices that share spectrum with radars, | ||
37 | satellites, and other licensed and unlicensed devices, it is sometimes | ||
38 | necessary to dynamically detect, avoid, and limit usage to avoid | ||
39 | interference with these devices. In many instances Intel is required to | ||
40 | provide test data to prove regional and local compliance to regional and | ||
41 | governmental regulations before certification or approval to use the | ||
42 | product is granted. Intel's wireless LAN's EEPROM, firmware, and | ||
43 | software driver are designed to carefully control parameters that affect | ||
44 | radio operation and to ensure electromagnetic compliance (EMC). These | ||
45 | parameters include, without limitation, RF power, spectrum usage, | ||
46 | channel scanning, and human exposure. | ||
47 | |||
48 | For these reasons Intel cannot permit any manipulation by third parties | ||
49 | of the software provided in binary format with the wireless WLAN | ||
50 | adapters (e.g., the EEPROM and firmware). Furthermore, if you use any | ||
51 | patches, utilities, or code with the Intel wireless LAN adapters that | ||
52 | have been manipulated by an unauthorized party (i.e., patches, | ||
53 | utilities, or code (including open source code modifications) which have | ||
54 | not been validated by Intel), (i) you will be solely responsible for | ||
55 | ensuring the regulatory compliance of the products, (ii) Intel will bear | ||
56 | no liability, under any theory of liability for any issues associated | ||
57 | with the modified products, including without limitation, claims under | ||
58 | the warranty and/or issues arising from regulatory non-compliance, and | ||
59 | (iii) Intel will not provide or be required to assist in providing | ||
60 | support to any third parties for such modified products. | ||
61 | |||
62 | Note: Many regulatory agencies consider Wireless LAN adapters to be | ||
63 | modules, and accordingly, condition system-level regulatory approval | ||
64 | upon receipt and review of test data documenting that the antennas and | ||
65 | system configuration do not cause the EMC and radio operation to be | ||
66 | non-compliant. | ||
67 | |||
68 | The drivers available for download from SourceForge are provided as a | ||
69 | part of a development project. Conformance to local regulatory | ||
70 | requirements is the responsibility of the individual developer. As | ||
71 | such, if you are interested in deploying or shipping a driver as part of | ||
72 | solution intended to be used for purposes other than development, please | ||
73 | obtain a tested driver from Intel Customer Support at: | ||
74 | |||
75 | http://support.intel.com/support/notebook/sb/CS-006408.htm | ||
76 | |||
77 | |||
78 | 1. Introduction | ||
79 | ----------------------------------------------- | ||
25 | 80 | ||
26 | This document provides a brief overview of the features supported by the | 81 | This document provides a brief overview of the features supported by the |
27 | IPW2100 driver project. The main project website, where the latest | 82 | IPW2100 driver project. The main project website, where the latest |
@@ -34,9 +89,8 @@ potential fixes and patches, as well as links to the development mailing list | |||
34 | for the driver project. | 89 | for the driver project. |
35 | 90 | ||
36 | 91 | ||
37 | =========================== | 92 | 2. Release 1.1.3 Current Supported Features |
38 | 1. Release 1.1.0 Current Supported Features | 93 | ----------------------------------------------- |
39 | --------------------------- | ||
40 | - Managed (BSS) and Ad-Hoc (IBSS) | 94 | - Managed (BSS) and Ad-Hoc (IBSS) |
41 | - WEP (shared key and open) | 95 | - WEP (shared key and open) |
42 | - Wireless Tools support | 96 | - Wireless Tools support |
@@ -51,9 +105,8 @@ on the amount of validation and interoperability testing that has been | |||
51 | performed on a given feature. | 105 | performed on a given feature. |
52 | 106 | ||
53 | 107 | ||
54 | =========================== | 108 | 3. Command Line Parameters |
55 | 2. Command Line Parameters | 109 | ----------------------------------------------- |
56 | --------------------------- | ||
57 | 110 | ||
58 | If the driver is built as a module, the following optional parameters are used | 111 | If the driver is built as a module, the following optional parameters are used |
59 | by entering them on the command line with the modprobe command using this | 112 | by entering them on the command line with the modprobe command using this |
@@ -75,9 +128,9 @@ associate boolean associate=0 /* Do NOT auto associate */ | |||
75 | disable boolean disable=1 /* Do not power the HW */ | 128 | disable boolean disable=1 /* Do not power the HW */ |
76 | 129 | ||
77 | 130 | ||
78 | =========================== | 131 | 4. Sysfs Helper Files |
79 | 3. Sysfs Helper Files | ||
80 | --------------------------- | 132 | --------------------------- |
133 | ----------------------------------------------- | ||
81 | 134 | ||
82 | There are several ways to control the behavior of the driver. Many of the | 135 | There are several ways to control the behavior of the driver. Many of the |
83 | general capabilities are exposed through the Wireless Tools (iwconfig). There | 136 | general capabilities are exposed through the Wireless Tools (iwconfig). There |
@@ -120,9 +173,8 @@ For the device level files, see /sys/bus/pci/drivers/ipw2100: | |||
120 | based RF kill from ON -> OFF -> ON, the radio will NOT come back on | 173 | based RF kill from ON -> OFF -> ON, the radio will NOT come back on |
121 | 174 | ||
122 | 175 | ||
123 | =========================== | 176 | 5. Radio Kill Switch |
124 | 4. Radio Kill Switch | 177 | ----------------------------------------------- |
125 | --------------------------- | ||
126 | Most laptops provide the ability for the user to physically disable the radio. | 178 | Most laptops provide the ability for the user to physically disable the radio. |
127 | Some vendors have implemented this as a physical switch that requires no | 179 | Some vendors have implemented this as a physical switch that requires no |
128 | software to turn the radio off and on. On other laptops, however, the switch | 180 | software to turn the radio off and on. On other laptops, however, the switch |
@@ -134,9 +186,8 @@ See the Sysfs helper file 'rf_kill' for determining the state of the RF switch | |||
134 | on your system. | 186 | on your system. |
135 | 187 | ||
136 | 188 | ||
137 | =========================== | 189 | 6. Dynamic Firmware |
138 | 5. Dynamic Firmware | 190 | ----------------------------------------------- |
139 | --------------------------- | ||
140 | As the firmware is licensed under a restricted use license, it can not be | 191 | As the firmware is licensed under a restricted use license, it can not be |
141 | included within the kernel sources. To enable the IPW2100 you will need a | 192 | included within the kernel sources. To enable the IPW2100 you will need a |
142 | firmware image to load into the wireless NIC's processors. | 193 | firmware image to load into the wireless NIC's processors. |
@@ -146,9 +197,8 @@ You can obtain these images from <http://ipw2100.sf.net/firmware.php>. | |||
146 | See INSTALL for instructions on installing the firmware. | 197 | See INSTALL for instructions on installing the firmware. |
147 | 198 | ||
148 | 199 | ||
149 | =========================== | 200 | 7. Power Management |
150 | 6. Power Management | 201 | ----------------------------------------------- |
151 | --------------------------- | ||
152 | The IPW2100 supports the configuration of the Power Save Protocol | 202 | The IPW2100 supports the configuration of the Power Save Protocol |
153 | through a private wireless extension interface. The IPW2100 supports | 203 | through a private wireless extension interface. The IPW2100 supports |
154 | the following different modes: | 204 | the following different modes: |
@@ -200,9 +250,8 @@ xxxx/yyyy will be replaced with 'off' -- the level reported will be the active | |||
200 | level if `iwconfig eth1 power on` is invoked. | 250 | level if `iwconfig eth1 power on` is invoked. |
201 | 251 | ||
202 | 252 | ||
203 | =========================== | 253 | 8. Support |
204 | 7. Support | 254 | ----------------------------------------------- |
205 | --------------------------- | ||
206 | 255 | ||
207 | For general development information and support, | 256 | For general development information and support, |
208 | go to: | 257 | go to: |
@@ -218,9 +267,8 @@ For installation support on the ipw2100 1.1.0 driver on Linux kernels | |||
218 | 267 | ||
219 | http://supportmail.intel.com | 268 | http://supportmail.intel.com |
220 | 269 | ||
221 | =========================== | 270 | 9. License |
222 | 8. License | 271 | ----------------------------------------------- |
223 | --------------------------- | ||
224 | 272 | ||
225 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. | 273 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. |
226 | 274 | ||
diff --git a/Documentation/networking/README.ipw2200 b/Documentation/networking/README.ipw2200 index 6916080c5f03..c6492d3839fa 100644 --- a/Documentation/networking/README.ipw2200 +++ b/Documentation/networking/README.ipw2200 | |||
@@ -1,33 +1,89 @@ | |||
1 | 1 | ||
2 | Intel(R) PRO/Wireless 2915ABG Driver for Linux in support of: | 2 | Intel(R) PRO/Wireless 2915ABG Driver for Linux in support of: |
3 | 3 | ||
4 | Intel(R) PRO/Wireless 2200BG Network Connection | 4 | Intel(R) PRO/Wireless 2200BG Network Connection |
5 | Intel(R) PRO/Wireless 2915ABG Network Connection | 5 | Intel(R) PRO/Wireless 2915ABG Network Connection |
6 | 6 | ||
7 | Note: The Intel(R) PRO/Wireless 2915ABG Driver for Linux and Intel(R) | 7 | Note: The Intel(R) PRO/Wireless 2915ABG Driver for Linux and Intel(R) |
8 | PRO/Wireless 2200BG Driver for Linux is a unified driver that works on | 8 | PRO/Wireless 2200BG Driver for Linux is a unified driver that works on |
9 | both hardware adapters listed above. In this document the Intel(R) | 9 | both hardware adapters listed above. In this document the Intel(R) |
10 | PRO/Wireless 2915ABG Driver for Linux will be used to reference the | 10 | PRO/Wireless 2915ABG Driver for Linux will be used to reference the |
11 | unified driver. | 11 | unified driver. |
12 | 12 | ||
13 | Copyright (C) 2004-2005, Intel Corporation | 13 | Copyright (C) 2004-2005, Intel Corporation |
14 | 14 | ||
15 | README.ipw2200 | 15 | README.ipw2200 |
16 | 16 | ||
17 | Version: 1.0.0 | 17 | Version: 1.0.8 |
18 | Date : January 31, 2005 | 18 | Date : October 20, 2005 |
19 | 19 | ||
20 | 20 | ||
21 | Index | 21 | Index |
22 | ----------------------------------------------- | 22 | ----------------------------------------------- |
23 | 0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER | ||
23 | 1. Introduction | 24 | 1. Introduction |
24 | 1.1. Overview of features | 25 | 1.1. Overview of features |
25 | 1.2. Module parameters | 26 | 1.2. Module parameters |
26 | 1.3. Wireless Extension Private Methods | 27 | 1.3. Wireless Extension Private Methods |
27 | 1.4. Sysfs Helper Files | 28 | 1.4. Sysfs Helper Files |
28 | 2. About the Version Numbers | 29 | 2. Ad-Hoc Networking |
29 | 3. Support | 30 | 3. Interacting with Wireless Tools |
30 | 4. License | 31 | 3.1. iwconfig mode |
32 | 4. About the Version Numbers | ||
33 | 5. Firmware installation | ||
34 | 6. Support | ||
35 | 7. License | ||
36 | |||
37 | |||
38 | 0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER | ||
39 | ----------------------------------------------- | ||
40 | |||
41 | Important Notice FOR ALL USERS OR DISTRIBUTORS!!!! | ||
42 | |||
43 | Intel wireless LAN adapters are engineered, manufactured, tested, and | ||
44 | quality checked to ensure that they meet all necessary local and | ||
45 | governmental regulatory agency requirements for the regions that they | ||
46 | are designated and/or marked to ship into. Since wireless LANs are | ||
47 | generally unlicensed devices that share spectrum with radars, | ||
48 | satellites, and other licensed and unlicensed devices, it is sometimes | ||
49 | necessary to dynamically detect, avoid, and limit usage to avoid | ||
50 | interference with these devices. In many instances Intel is required to | ||
51 | provide test data to prove regional and local compliance to regional and | ||
52 | governmental regulations before certification or approval to use the | ||
53 | product is granted. Intel's wireless LAN's EEPROM, firmware, and | ||
54 | software driver are designed to carefully control parameters that affect | ||
55 | radio operation and to ensure electromagnetic compliance (EMC). These | ||
56 | parameters include, without limitation, RF power, spectrum usage, | ||
57 | channel scanning, and human exposure. | ||
58 | |||
59 | For these reasons Intel cannot permit any manipulation by third parties | ||
60 | of the software provided in binary format with the wireless WLAN | ||
61 | adapters (e.g., the EEPROM and firmware). Furthermore, if you use any | ||
62 | patches, utilities, or code with the Intel wireless LAN adapters that | ||
63 | have been manipulated by an unauthorized party (i.e., patches, | ||
64 | utilities, or code (including open source code modifications) which have | ||
65 | not been validated by Intel), (i) you will be solely responsible for | ||
66 | ensuring the regulatory compliance of the products, (ii) Intel will bear | ||
67 | no liability, under any theory of liability for any issues associated | ||
68 | with the modified products, including without limitation, claims under | ||
69 | the warranty and/or issues arising from regulatory non-compliance, and | ||
70 | (iii) Intel will not provide or be required to assist in providing | ||
71 | support to any third parties for such modified products. | ||
72 | |||
73 | Note: Many regulatory agencies consider Wireless LAN adapters to be | ||
74 | modules, and accordingly, condition system-level regulatory approval | ||
75 | upon receipt and review of test data documenting that the antennas and | ||
76 | system configuration do not cause the EMC and radio operation to be | ||
77 | non-compliant. | ||
78 | |||
79 | The drivers available for download from SourceForge are provided as a | ||
80 | part of a development project. Conformance to local regulatory | ||
81 | requirements is the responsibility of the individual developer. As | ||
82 | such, if you are interested in deploying or shipping a driver as part of | ||
83 | solution intended to be used for purposes other than development, please | ||
84 | obtain a tested driver from Intel Customer Support at: | ||
85 | |||
86 | http://support.intel.com/support/notebook/sb/CS-006408.htm | ||
31 | 87 | ||
32 | 88 | ||
33 | 1. Introduction | 89 | 1. Introduction |
@@ -45,7 +101,7 @@ file. | |||
45 | 101 | ||
46 | 1.1. Overview of Features | 102 | 1.1. Overview of Features |
47 | ----------------------------------------------- | 103 | ----------------------------------------------- |
48 | The current release (1.0.0) supports the following features: | 104 | The current release (1.0.8) supports the following features: |
49 | 105 | ||
50 | + BSS mode (Infrastructure, Managed) | 106 | + BSS mode (Infrastructure, Managed) |
51 | + IBSS mode (Ad-Hoc) | 107 | + IBSS mode (Ad-Hoc) |
@@ -56,17 +112,27 @@ The current release (1.0.0) supports the following features: | |||
56 | + Full A rate support (2915 only) | 112 | + Full A rate support (2915 only) |
57 | + Transmit power control | 113 | + Transmit power control |
58 | + S state support (ACPI suspend/resume) | 114 | + S state support (ACPI suspend/resume) |
115 | |||
116 | The following features are currently enabled, but not officially | ||
117 | supported: | ||
118 | |||
119 | + WPA | ||
59 | + long/short preamble support | 120 | + long/short preamble support |
121 | + Monitor mode (aka RFMon) | ||
122 | |||
123 | The distinction between officially supported and enabled is a reflection | ||
124 | on the amount of validation and interoperability testing that has been | ||
125 | performed on a given feature. | ||
60 | 126 | ||
61 | 127 | ||
62 | 128 | ||
63 | 1.2. Command Line Parameters | 129 | 1.2. Command Line Parameters |
64 | ----------------------------------------------- | 130 | ----------------------------------------------- |
65 | 131 | ||
66 | Like many modules used in the Linux kernel, the Intel(R) PRO/Wireless | 132 | Like many modules used in the Linux kernel, the Intel(R) PRO/Wireless |
67 | 2915ABG Driver for Linux allows certain configuration options to be | 133 | 2915ABG Driver for Linux allows configuration options to be provided |
68 | provided as module parameters. The most common way to specify a module | 134 | as module parameters. The most common way to specify a module parameter |
69 | parameter is via the command line. | 135 | is via the command line. |
70 | 136 | ||
71 | The general form is: | 137 | The general form is: |
72 | 138 | ||
@@ -96,14 +162,18 @@ Where the supported parameter are: | |||
96 | 162 | ||
97 | debug | 163 | debug |
98 | If using a debug build, this is used to control the amount of debug | 164 | If using a debug build, this is used to control the amount of debug |
99 | info is logged. See the 'dval' and 'load' script for more info on | 165 | info is logged. See the 'dvals' and 'load' script for more info on |
100 | how to use this (the dval and load scripts are provided as part | 166 | how to use this (the dvals and load scripts are provided as part |
101 | of the ipw2200 development snapshot releases available from the | 167 | of the ipw2200 development snapshot releases available from the |
102 | SourceForge project at http://ipw2200.sf.net) | 168 | SourceForge project at http://ipw2200.sf.net) |
169 | |||
170 | led | ||
171 | Can be used to turn on experimental LED code. | ||
172 | 0 = Off, 1 = On. Default is 0. | ||
103 | 173 | ||
104 | mode | 174 | mode |
105 | Can be used to set the default mode of the adapter. | 175 | Can be used to set the default mode of the adapter. |
106 | 0 = Managed, 1 = Ad-Hoc | 176 | 0 = Managed, 1 = Ad-Hoc, 2 = Monitor |
107 | 177 | ||
108 | 178 | ||
109 | 1.3. Wireless Extension Private Methods | 179 | 1.3. Wireless Extension Private Methods |
@@ -164,8 +234,8 @@ The supported private methods are: | |||
164 | ----------------------------------------------- | 234 | ----------------------------------------------- |
165 | 235 | ||
166 | The Linux kernel provides a pseudo file system that can be used to | 236 | The Linux kernel provides a pseudo file system that can be used to |
167 | access various components of the operating system. The Intel(R) | 237 | access various components of the operating system. The Intel(R) |
168 | PRO/Wireless 2915ABG Driver for Linux exposes several configuration | 238 | PRO/Wireless 2915ABG Driver for Linux exposes several configuration |
169 | parameters through this mechanism. | 239 | parameters through this mechanism. |
170 | 240 | ||
171 | An entry in the sysfs can support reading and/or writing. You can | 241 | An entry in the sysfs can support reading and/or writing. You can |
@@ -184,13 +254,13 @@ You can set the debug level via: | |||
184 | 254 | ||
185 | Where $VALUE would be a number in the case of this sysfs entry. The | 255 | Where $VALUE would be a number in the case of this sysfs entry. The |
186 | input to sysfs files does not have to be a number. For example, the | 256 | input to sysfs files does not have to be a number. For example, the |
187 | firmware loader used by hotplug utilizes sysfs entries for transferring | 257 | firmware loader used by hotplug utilizes sysfs entries for transfering |
188 | the firmware image from user space into the driver. | 258 | the firmware image from user space into the driver. |
189 | 259 | ||
190 | The Intel(R) PRO/Wireless 2915ABG Driver for Linux exposes sysfs entries | 260 | The Intel(R) PRO/Wireless 2915ABG Driver for Linux exposes sysfs entries |
191 | at two levels -- driver level, which apply to all instances of the | 261 | at two levels -- driver level, which apply to all instances of the driver |
192 | driver (in the event that there are more than one device installed) and | 262 | (in the event that there are more than one device installed) and device |
193 | device level, which applies only to the single specific instance. | 263 | level, which applies only to the single specific instance. |
194 | 264 | ||
195 | 265 | ||
196 | 1.4.1 Driver Level Sysfs Helper Files | 266 | 1.4.1 Driver Level Sysfs Helper Files |
@@ -203,6 +273,7 @@ For the driver level files, look in /sys/bus/pci/drivers/ipw2200/ | |||
203 | This controls the same global as the 'debug' module parameter | 273 | This controls the same global as the 'debug' module parameter |
204 | 274 | ||
205 | 275 | ||
276 | |||
206 | 1.4.2 Device Level Sysfs Helper Files | 277 | 1.4.2 Device Level Sysfs Helper Files |
207 | ----------------------------------------------- | 278 | ----------------------------------------------- |
208 | 279 | ||
@@ -213,7 +284,7 @@ For the device level files, look in | |||
213 | For example: | 284 | For example: |
214 | /sys/bus/pci/drivers/ipw2200/0000:02:01.0 | 285 | /sys/bus/pci/drivers/ipw2200/0000:02:01.0 |
215 | 286 | ||
216 | For the device level files, see /sys/bus/pci/[drivers/ipw2200: | 287 | For the device level files, see /sys/bus/pci/drivers/ipw2200: |
217 | 288 | ||
218 | rf_kill | 289 | rf_kill |
219 | read - | 290 | read - |
@@ -231,8 +302,59 @@ For the device level files, see /sys/bus/pci/[drivers/ipw2200: | |||
231 | ucode | 302 | ucode |
232 | read-only access to the ucode version number | 303 | read-only access to the ucode version number |
233 | 304 | ||
305 | led | ||
306 | read - | ||
307 | 0 = LED code disabled | ||
308 | 1 = LED code enabled | ||
309 | write - | ||
310 | 0 = Disable LED code | ||
311 | 1 = Enable LED code | ||
312 | |||
313 | NOTE: The LED code has been reported to hang some systems when | ||
314 | running ifconfig and is therefore disabled by default. | ||
315 | |||
316 | |||
317 | 2. Ad-Hoc Networking | ||
318 | ----------------------------------------------- | ||
319 | |||
320 | When using a device in an Ad-Hoc network, it is useful to understand the | ||
321 | sequence and requirements for the driver to be able to create, join, or | ||
322 | merge networks. | ||
323 | |||
324 | The following attempts to provide enough information so that you can | ||
325 | have a consistent experience while using the driver as a member of an | ||
326 | Ad-Hoc network. | ||
327 | |||
328 | 2.1. Joining an Ad-Hoc Network | ||
329 | ----------------------------------------------- | ||
330 | |||
331 | The easiest way to get onto an Ad-Hoc network is to join one that | ||
332 | already exists. | ||
234 | 333 | ||
235 | 2. About the Version Numbers | 334 | 2.2. Creating an Ad-Hoc Network |
335 | ----------------------------------------------- | ||
336 | |||
337 | An Ad-Hoc networks is created using the syntax of the Wireless tool. | ||
338 | |||
339 | For Example: | ||
340 | iwconfig eth1 mode ad-hoc essid testing channel 2 | ||
341 | |||
342 | 2.3. Merging Ad-Hoc Networks | ||
343 | ----------------------------------------------- | ||
344 | |||
345 | |||
346 | 3. Interaction with Wireless Tools | ||
347 | ----------------------------------------------- | ||
348 | |||
349 | 3.1 iwconfig mode | ||
350 | ----------------------------------------------- | ||
351 | |||
352 | When configuring the mode of the adapter, all run-time configured parameters | ||
353 | are reset to the value used when the module was loaded. This includes | ||
354 | channels, rates, ESSID, etc. | ||
355 | |||
356 | |||
357 | 4. About the Version Numbers | ||
236 | ----------------------------------------------- | 358 | ----------------------------------------------- |
237 | 359 | ||
238 | Due to the nature of open source development projects, there are | 360 | Due to the nature of open source development projects, there are |
@@ -259,12 +381,23 @@ available as quickly as possible, unknown anomalies should be expected. | |||
259 | The major version number will be incremented when significant changes | 381 | The major version number will be incremented when significant changes |
260 | are made to the driver. Currently, there are no major changes planned. | 382 | are made to the driver. Currently, there are no major changes planned. |
261 | 383 | ||
384 | 5. Firmware installation | ||
385 | ---------------------------------------------- | ||
386 | |||
387 | The driver requires a firmware image, download it and extract the | ||
388 | files under /lib/firmware (or wherever your hotplug's firmware.agent | ||
389 | will look for firmware files) | ||
390 | |||
391 | The firmware can be downloaded from the following URL: | ||
262 | 392 | ||
263 | 3. Support | 393 | http://ipw2200.sf.net/ |
394 | |||
395 | |||
396 | 6. Support | ||
264 | ----------------------------------------------- | 397 | ----------------------------------------------- |
265 | 398 | ||
266 | For installation support of the 1.0.0 version, you can contact | 399 | For direct support of the 1.0.0 version, you can contact |
267 | http://supportmail.intel.com, or you can use the open source project | 400 | http://supportmail.intel.com, or you can use the open source project |
268 | support. | 401 | support. |
269 | 402 | ||
270 | For general information and support, go to: | 403 | For general information and support, go to: |
@@ -272,7 +405,7 @@ For general information and support, go to: | |||
272 | http://ipw2200.sf.net/ | 405 | http://ipw2200.sf.net/ |
273 | 406 | ||
274 | 407 | ||
275 | 4. License | 408 | 7. License |
276 | ----------------------------------------------- | 409 | ----------------------------------------------- |
277 | 410 | ||
278 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. | 411 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. |
@@ -297,4 +430,3 @@ For general information and support, go to: | |||
297 | James P. Ketrenos <ipw2100-admin@linux.intel.com> | 430 | James P. Ketrenos <ipw2100-admin@linux.intel.com> |
298 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 431 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
299 | 432 | ||
300 | |||
diff --git a/MAINTAINERS b/MAINTAINERS index 995bfd8e6e7f..5541f9970b87 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1330,6 +1330,24 @@ M: john.ronciak@intel.com | |||
1330 | W: http://sourceforge.net/projects/e1000/ | 1330 | W: http://sourceforge.net/projects/e1000/ |
1331 | S: Supported | 1331 | S: Supported |
1332 | 1332 | ||
1333 | INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT | ||
1334 | P: Yi Zhu | ||
1335 | M: yi.zhu@intel.com | ||
1336 | P: James Ketrenos | ||
1337 | M: jketreno@linux.intel.com | ||
1338 | L: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel | ||
1339 | W: http://ipw2100.sourceforge.net | ||
1340 | S: Supported | ||
1341 | |||
1342 | INTEL PRO/WIRELESS 2915ABG NETWORK CONNECTION SUPPORT | ||
1343 | P: Yi Zhu | ||
1344 | M: yi.zhu@intel.com | ||
1345 | P: James Ketrenos | ||
1346 | M: jketreno@linux.intel.com | ||
1347 | L: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel | ||
1348 | W: http://ipw2200.sourceforge.net | ||
1349 | S: Supported | ||
1350 | |||
1333 | IOC3 DRIVER | 1351 | IOC3 DRIVER |
1334 | P: Ralf Baechle | 1352 | P: Ralf Baechle |
1335 | M: ralf@linux-mips.org | 1353 | M: ralf@linux-mips.org |
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index fe865d9a3721..4cf31a2ae19c 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -243,34 +243,18 @@ static int uml_net_change_mtu(struct net_device *dev, int new_mtu) | |||
243 | return err; | 243 | return err; |
244 | } | 244 | } |
245 | 245 | ||
246 | static int uml_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 246 | static void uml_net_get_drvinfo(struct net_device *dev, |
247 | { | 247 | struct ethtool_drvinfo *info) |
248 | static const struct ethtool_drvinfo info = { | 248 | { |
249 | .cmd = ETHTOOL_GDRVINFO, | 249 | strcpy(info->driver, DRIVER_NAME); |
250 | .driver = DRIVER_NAME, | 250 | strcpy(info->version, "42"); |
251 | .version = "42", | ||
252 | }; | ||
253 | void *useraddr; | ||
254 | u32 ethcmd; | ||
255 | |||
256 | switch (cmd) { | ||
257 | case SIOCETHTOOL: | ||
258 | useraddr = ifr->ifr_data; | ||
259 | if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) | ||
260 | return -EFAULT; | ||
261 | switch (ethcmd) { | ||
262 | case ETHTOOL_GDRVINFO: | ||
263 | if (copy_to_user(useraddr, &info, sizeof(info))) | ||
264 | return -EFAULT; | ||
265 | return 0; | ||
266 | default: | ||
267 | return -EOPNOTSUPP; | ||
268 | } | ||
269 | default: | ||
270 | return -EINVAL; | ||
271 | } | ||
272 | } | 251 | } |
273 | 252 | ||
253 | static struct ethtool_ops uml_net_ethtool_ops = { | ||
254 | .get_drvinfo = uml_net_get_drvinfo, | ||
255 | .get_link = ethtool_op_get_link, | ||
256 | }; | ||
257 | |||
274 | void uml_net_user_timer_expire(unsigned long _conn) | 258 | void uml_net_user_timer_expire(unsigned long _conn) |
275 | { | 259 | { |
276 | #ifdef undef | 260 | #ifdef undef |
@@ -359,7 +343,7 @@ static int eth_configure(int n, void *init, char *mac, | |||
359 | dev->tx_timeout = uml_net_tx_timeout; | 343 | dev->tx_timeout = uml_net_tx_timeout; |
360 | dev->set_mac_address = uml_net_set_mac; | 344 | dev->set_mac_address = uml_net_set_mac; |
361 | dev->change_mtu = uml_net_change_mtu; | 345 | dev->change_mtu = uml_net_change_mtu; |
362 | dev->do_ioctl = uml_net_ioctl; | 346 | dev->ethtool_ops = ¨_net_ethtool_ops; |
363 | dev->watchdog_timeo = (HZ >> 1); | 347 | dev->watchdog_timeo = (HZ >> 1); |
364 | dev->irq = UM_ETH_IRQ; | 348 | dev->irq = UM_ETH_IRQ; |
365 | 349 | ||
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platform-iss/network.c index 0682ffd38175..96b9bb4a478d 100644 --- a/arch/xtensa/platform-iss/network.c +++ b/arch/xtensa/platform-iss/network.c | |||
@@ -611,38 +611,6 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu) | |||
611 | return -EINVAL; | 611 | return -EINVAL; |
612 | } | 612 | } |
613 | 613 | ||
614 | static int iss_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | ||
615 | { | ||
616 | #if 0 | ||
617 | static const struct ethtool_drvinfo info = { | ||
618 | .cmd = ETHTOOL_GDRVINFO, | ||
619 | .driver = DRIVER_NAME, | ||
620 | .version = "42", | ||
621 | }; | ||
622 | void *useraddr; | ||
623 | u32 ethcmd; | ||
624 | |||
625 | switch (cmd) { | ||
626 | case SIOCETHTOOL: | ||
627 | useraddr = ifr->ifr_data; | ||
628 | if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) | ||
629 | return -EFAULT; | ||
630 | |||
631 | switch (ethcmd) { | ||
632 | case ETHTOOL_GDRVINFO: | ||
633 | if (copy_to_user(useraddr, &info, sizeof(info))) | ||
634 | return -EFAULT; | ||
635 | return 0; | ||
636 | default: | ||
637 | return -EOPNOTSUPP; | ||
638 | } | ||
639 | default: | ||
640 | return -EINVAL; | ||
641 | } | ||
642 | #endif | ||
643 | return -EINVAL; | ||
644 | } | ||
645 | |||
646 | void iss_net_user_timer_expire(unsigned long _conn) | 614 | void iss_net_user_timer_expire(unsigned long _conn) |
647 | { | 615 | { |
648 | } | 616 | } |
@@ -730,7 +698,6 @@ static int iss_net_configure(int index, char *init) | |||
730 | dev->tx_timeout = iss_net_tx_timeout; | 698 | dev->tx_timeout = iss_net_tx_timeout; |
731 | dev->set_mac_address = iss_net_set_mac; | 699 | dev->set_mac_address = iss_net_set_mac; |
732 | dev->change_mtu = iss_net_change_mtu; | 700 | dev->change_mtu = iss_net_change_mtu; |
733 | dev->do_ioctl = iss_net_ioctl; | ||
734 | dev->watchdog_timeo = (HZ >> 1); | 701 | dev->watchdog_timeo = (HZ >> 1); |
735 | dev->irq = -1; | 702 | dev->irq = -1; |
736 | 703 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 24f1691b84f9..5c69d57f8548 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -447,7 +447,7 @@ config NET_SB1250_MAC | |||
447 | 447 | ||
448 | config SGI_IOC3_ETH | 448 | config SGI_IOC3_ETH |
449 | bool "SGI IOC3 Ethernet" | 449 | bool "SGI IOC3 Ethernet" |
450 | depends on NET_ETHERNET && PCI && SGI_IP27 && BROKEN | 450 | depends on NET_ETHERNET && PCI && SGI_IP27 |
451 | select CRC32 | 451 | select CRC32 |
452 | select MII | 452 | select MII |
453 | help | 453 | help |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 819a17921cb9..c53848f787eb 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -28,8 +28,8 @@ | |||
28 | 28 | ||
29 | #define DRV_MODULE_NAME "b44" | 29 | #define DRV_MODULE_NAME "b44" |
30 | #define PFX DRV_MODULE_NAME ": " | 30 | #define PFX DRV_MODULE_NAME ": " |
31 | #define DRV_MODULE_VERSION "0.95" | 31 | #define DRV_MODULE_VERSION "0.96" |
32 | #define DRV_MODULE_RELDATE "Aug 3, 2004" | 32 | #define DRV_MODULE_RELDATE "Nov 8, 2005" |
33 | 33 | ||
34 | #define B44_DEF_MSG_ENABLE \ | 34 | #define B44_DEF_MSG_ENABLE \ |
35 | (NETIF_MSG_DRV | \ | 35 | (NETIF_MSG_DRV | \ |
@@ -101,14 +101,16 @@ MODULE_DEVICE_TABLE(pci, b44_pci_tbl); | |||
101 | static void b44_halt(struct b44 *); | 101 | static void b44_halt(struct b44 *); |
102 | static void b44_init_rings(struct b44 *); | 102 | static void b44_init_rings(struct b44 *); |
103 | static void b44_init_hw(struct b44 *); | 103 | static void b44_init_hw(struct b44 *); |
104 | static int b44_poll(struct net_device *dev, int *budget); | ||
105 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
106 | static void b44_poll_controller(struct net_device *dev); | ||
107 | #endif | ||
108 | 104 | ||
109 | static int dma_desc_align_mask; | 105 | static int dma_desc_align_mask; |
110 | static int dma_desc_sync_size; | 106 | static int dma_desc_sync_size; |
111 | 107 | ||
108 | static const char b44_gstrings[][ETH_GSTRING_LEN] = { | ||
109 | #define _B44(x...) # x, | ||
110 | B44_STAT_REG_DECLARE | ||
111 | #undef _B44 | ||
112 | }; | ||
113 | |||
112 | static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev, | 114 | static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev, |
113 | dma_addr_t dma_base, | 115 | dma_addr_t dma_base, |
114 | unsigned long offset, | 116 | unsigned long offset, |
@@ -501,7 +503,10 @@ static void b44_stats_update(struct b44 *bp) | |||
501 | for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) { | 503 | for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) { |
502 | *val++ += br32(bp, reg); | 504 | *val++ += br32(bp, reg); |
503 | } | 505 | } |
504 | val = &bp->hw_stats.rx_good_octets; | 506 | |
507 | /* Pad */ | ||
508 | reg += 8*4UL; | ||
509 | |||
505 | for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) { | 510 | for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) { |
506 | *val++ += br32(bp, reg); | 511 | *val++ += br32(bp, reg); |
507 | } | 512 | } |
@@ -652,7 +657,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
652 | 657 | ||
653 | /* Hardware bug work-around, the chip is unable to do PCI DMA | 658 | /* Hardware bug work-around, the chip is unable to do PCI DMA |
654 | to/from anything above 1GB :-( */ | 659 | to/from anything above 1GB :-( */ |
655 | if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) { | 660 | if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { |
656 | /* Sigh... */ | 661 | /* Sigh... */ |
657 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | 662 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); |
658 | dev_kfree_skb_any(skb); | 663 | dev_kfree_skb_any(skb); |
@@ -662,7 +667,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
662 | mapping = pci_map_single(bp->pdev, skb->data, | 667 | mapping = pci_map_single(bp->pdev, skb->data, |
663 | RX_PKT_BUF_SZ, | 668 | RX_PKT_BUF_SZ, |
664 | PCI_DMA_FROMDEVICE); | 669 | PCI_DMA_FROMDEVICE); |
665 | if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) { | 670 | if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { |
666 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | 671 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); |
667 | dev_kfree_skb_any(skb); | 672 | dev_kfree_skb_any(skb); |
668 | return -ENOMEM; | 673 | return -ENOMEM; |
@@ -889,11 +894,10 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
889 | { | 894 | { |
890 | struct net_device *dev = dev_id; | 895 | struct net_device *dev = dev_id; |
891 | struct b44 *bp = netdev_priv(dev); | 896 | struct b44 *bp = netdev_priv(dev); |
892 | unsigned long flags; | ||
893 | u32 istat, imask; | 897 | u32 istat, imask; |
894 | int handled = 0; | 898 | int handled = 0; |
895 | 899 | ||
896 | spin_lock_irqsave(&bp->lock, flags); | 900 | spin_lock(&bp->lock); |
897 | 901 | ||
898 | istat = br32(bp, B44_ISTAT); | 902 | istat = br32(bp, B44_ISTAT); |
899 | imask = br32(bp, B44_IMASK); | 903 | imask = br32(bp, B44_IMASK); |
@@ -904,6 +908,12 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
904 | istat &= imask; | 908 | istat &= imask; |
905 | if (istat) { | 909 | if (istat) { |
906 | handled = 1; | 910 | handled = 1; |
911 | |||
912 | if (unlikely(!netif_running(dev))) { | ||
913 | printk(KERN_INFO "%s: late interrupt.\n", dev->name); | ||
914 | goto irq_ack; | ||
915 | } | ||
916 | |||
907 | if (netif_rx_schedule_prep(dev)) { | 917 | if (netif_rx_schedule_prep(dev)) { |
908 | /* NOTE: These writes are posted by the readback of | 918 | /* NOTE: These writes are posted by the readback of |
909 | * the ISTAT register below. | 919 | * the ISTAT register below. |
@@ -916,10 +926,11 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
916 | dev->name); | 926 | dev->name); |
917 | } | 927 | } |
918 | 928 | ||
929 | irq_ack: | ||
919 | bw32(bp, B44_ISTAT, istat); | 930 | bw32(bp, B44_ISTAT, istat); |
920 | br32(bp, B44_ISTAT); | 931 | br32(bp, B44_ISTAT); |
921 | } | 932 | } |
922 | spin_unlock_irqrestore(&bp->lock, flags); | 933 | spin_unlock(&bp->lock); |
923 | return IRQ_RETVAL(handled); | 934 | return IRQ_RETVAL(handled); |
924 | } | 935 | } |
925 | 936 | ||
@@ -947,6 +958,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
947 | { | 958 | { |
948 | struct b44 *bp = netdev_priv(dev); | 959 | struct b44 *bp = netdev_priv(dev); |
949 | struct sk_buff *bounce_skb; | 960 | struct sk_buff *bounce_skb; |
961 | int rc = NETDEV_TX_OK; | ||
950 | dma_addr_t mapping; | 962 | dma_addr_t mapping; |
951 | u32 len, entry, ctrl; | 963 | u32 len, entry, ctrl; |
952 | 964 | ||
@@ -956,29 +968,28 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
956 | /* This is a hard error, log it. */ | 968 | /* This is a hard error, log it. */ |
957 | if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { | 969 | if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { |
958 | netif_stop_queue(dev); | 970 | netif_stop_queue(dev); |
959 | spin_unlock_irq(&bp->lock); | ||
960 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", | 971 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", |
961 | dev->name); | 972 | dev->name); |
962 | return 1; | 973 | goto err_out; |
963 | } | 974 | } |
964 | 975 | ||
965 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); | 976 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); |
966 | if(mapping+len > B44_DMA_MASK) { | 977 | if (mapping + len > B44_DMA_MASK) { |
967 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ | 978 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ |
968 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); | 979 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); |
969 | 980 | ||
970 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, | 981 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, |
971 | GFP_ATOMIC|GFP_DMA); | 982 | GFP_ATOMIC|GFP_DMA); |
972 | if (!bounce_skb) | 983 | if (!bounce_skb) |
973 | return NETDEV_TX_BUSY; | 984 | goto err_out; |
974 | 985 | ||
975 | mapping = pci_map_single(bp->pdev, bounce_skb->data, | 986 | mapping = pci_map_single(bp->pdev, bounce_skb->data, |
976 | len, PCI_DMA_TODEVICE); | 987 | len, PCI_DMA_TODEVICE); |
977 | if(mapping+len > B44_DMA_MASK) { | 988 | if (mapping + len > B44_DMA_MASK) { |
978 | pci_unmap_single(bp->pdev, mapping, | 989 | pci_unmap_single(bp->pdev, mapping, |
979 | len, PCI_DMA_TODEVICE); | 990 | len, PCI_DMA_TODEVICE); |
980 | dev_kfree_skb_any(bounce_skb); | 991 | dev_kfree_skb_any(bounce_skb); |
981 | return NETDEV_TX_BUSY; | 992 | goto err_out; |
982 | } | 993 | } |
983 | 994 | ||
984 | memcpy(skb_put(bounce_skb, len), skb->data, skb->len); | 995 | memcpy(skb_put(bounce_skb, len), skb->data, skb->len); |
@@ -1018,11 +1029,16 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1018 | if (TX_BUFFS_AVAIL(bp) < 1) | 1029 | if (TX_BUFFS_AVAIL(bp) < 1) |
1019 | netif_stop_queue(dev); | 1030 | netif_stop_queue(dev); |
1020 | 1031 | ||
1032 | dev->trans_start = jiffies; | ||
1033 | |||
1034 | out_unlock: | ||
1021 | spin_unlock_irq(&bp->lock); | 1035 | spin_unlock_irq(&bp->lock); |
1022 | 1036 | ||
1023 | dev->trans_start = jiffies; | 1037 | return rc; |
1024 | 1038 | ||
1025 | return 0; | 1039 | err_out: |
1040 | rc = NETDEV_TX_BUSY; | ||
1041 | goto out_unlock; | ||
1026 | } | 1042 | } |
1027 | 1043 | ||
1028 | static int b44_change_mtu(struct net_device *dev, int new_mtu) | 1044 | static int b44_change_mtu(struct net_device *dev, int new_mtu) |
@@ -1096,8 +1112,7 @@ static void b44_free_rings(struct b44 *bp) | |||
1096 | * | 1112 | * |
1097 | * The chip has been shut down and the driver detached from | 1113 | * The chip has been shut down and the driver detached from |
1098 | * the networking, so no interrupts or new tx packets will | 1114 | * the networking, so no interrupts or new tx packets will |
1099 | * end up in the driver. bp->lock is not held and we are not | 1115 | * end up in the driver. |
1100 | * in an interrupt context and thus may sleep. | ||
1101 | */ | 1116 | */ |
1102 | static void b44_init_rings(struct b44 *bp) | 1117 | static void b44_init_rings(struct b44 *bp) |
1103 | { | 1118 | { |
@@ -1169,16 +1184,14 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1169 | int size; | 1184 | int size; |
1170 | 1185 | ||
1171 | size = B44_RX_RING_SIZE * sizeof(struct ring_info); | 1186 | size = B44_RX_RING_SIZE * sizeof(struct ring_info); |
1172 | bp->rx_buffers = kmalloc(size, GFP_KERNEL); | 1187 | bp->rx_buffers = kzalloc(size, GFP_KERNEL); |
1173 | if (!bp->rx_buffers) | 1188 | if (!bp->rx_buffers) |
1174 | goto out_err; | 1189 | goto out_err; |
1175 | memset(bp->rx_buffers, 0, size); | ||
1176 | 1190 | ||
1177 | size = B44_TX_RING_SIZE * sizeof(struct ring_info); | 1191 | size = B44_TX_RING_SIZE * sizeof(struct ring_info); |
1178 | bp->tx_buffers = kmalloc(size, GFP_KERNEL); | 1192 | bp->tx_buffers = kzalloc(size, GFP_KERNEL); |
1179 | if (!bp->tx_buffers) | 1193 | if (!bp->tx_buffers) |
1180 | goto out_err; | 1194 | goto out_err; |
1181 | memset(bp->tx_buffers, 0, size); | ||
1182 | 1195 | ||
1183 | size = DMA_TABLE_BYTES; | 1196 | size = DMA_TABLE_BYTES; |
1184 | bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); | 1197 | bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); |
@@ -1189,10 +1202,10 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1189 | struct dma_desc *rx_ring; | 1202 | struct dma_desc *rx_ring; |
1190 | dma_addr_t rx_ring_dma; | 1203 | dma_addr_t rx_ring_dma; |
1191 | 1204 | ||
1192 | if (!(rx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL))) | 1205 | rx_ring = kzalloc(size, GFP_KERNEL); |
1206 | if (!rx_ring) | ||
1193 | goto out_err; | 1207 | goto out_err; |
1194 | 1208 | ||
1195 | memset(rx_ring, 0, size); | ||
1196 | rx_ring_dma = dma_map_single(&bp->pdev->dev, rx_ring, | 1209 | rx_ring_dma = dma_map_single(&bp->pdev->dev, rx_ring, |
1197 | DMA_TABLE_BYTES, | 1210 | DMA_TABLE_BYTES, |
1198 | DMA_BIDIRECTIONAL); | 1211 | DMA_BIDIRECTIONAL); |
@@ -1215,10 +1228,10 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1215 | struct dma_desc *tx_ring; | 1228 | struct dma_desc *tx_ring; |
1216 | dma_addr_t tx_ring_dma; | 1229 | dma_addr_t tx_ring_dma; |
1217 | 1230 | ||
1218 | if (!(tx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL))) | 1231 | tx_ring = kzalloc(size, GFP_KERNEL); |
1232 | if (!tx_ring) | ||
1219 | goto out_err; | 1233 | goto out_err; |
1220 | 1234 | ||
1221 | memset(tx_ring, 0, size); | ||
1222 | tx_ring_dma = dma_map_single(&bp->pdev->dev, tx_ring, | 1235 | tx_ring_dma = dma_map_single(&bp->pdev->dev, tx_ring, |
1223 | DMA_TABLE_BYTES, | 1236 | DMA_TABLE_BYTES, |
1224 | DMA_TO_DEVICE); | 1237 | DMA_TO_DEVICE); |
@@ -1381,22 +1394,21 @@ static int b44_open(struct net_device *dev) | |||
1381 | 1394 | ||
1382 | err = b44_alloc_consistent(bp); | 1395 | err = b44_alloc_consistent(bp); |
1383 | if (err) | 1396 | if (err) |
1384 | return err; | 1397 | goto out; |
1385 | |||
1386 | err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); | ||
1387 | if (err) | ||
1388 | goto err_out_free; | ||
1389 | |||
1390 | spin_lock_irq(&bp->lock); | ||
1391 | 1398 | ||
1392 | b44_init_rings(bp); | 1399 | b44_init_rings(bp); |
1393 | b44_init_hw(bp); | 1400 | b44_init_hw(bp); |
1394 | bp->flags |= B44_FLAG_INIT_COMPLETE; | ||
1395 | 1401 | ||
1396 | netif_carrier_off(dev); | 1402 | netif_carrier_off(dev); |
1397 | b44_check_phy(bp); | 1403 | b44_check_phy(bp); |
1398 | 1404 | ||
1399 | spin_unlock_irq(&bp->lock); | 1405 | err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); |
1406 | if (unlikely(err < 0)) { | ||
1407 | b44_chip_reset(bp); | ||
1408 | b44_free_rings(bp); | ||
1409 | b44_free_consistent(bp); | ||
1410 | goto out; | ||
1411 | } | ||
1400 | 1412 | ||
1401 | init_timer(&bp->timer); | 1413 | init_timer(&bp->timer); |
1402 | bp->timer.expires = jiffies + HZ; | 1414 | bp->timer.expires = jiffies + HZ; |
@@ -1405,11 +1417,7 @@ static int b44_open(struct net_device *dev) | |||
1405 | add_timer(&bp->timer); | 1417 | add_timer(&bp->timer); |
1406 | 1418 | ||
1407 | b44_enable_ints(bp); | 1419 | b44_enable_ints(bp); |
1408 | 1420 | out: | |
1409 | return 0; | ||
1410 | |||
1411 | err_out_free: | ||
1412 | b44_free_consistent(bp); | ||
1413 | return err; | 1421 | return err; |
1414 | } | 1422 | } |
1415 | 1423 | ||
@@ -1444,6 +1452,8 @@ static int b44_close(struct net_device *dev) | |||
1444 | 1452 | ||
1445 | netif_stop_queue(dev); | 1453 | netif_stop_queue(dev); |
1446 | 1454 | ||
1455 | netif_poll_disable(dev); | ||
1456 | |||
1447 | del_timer_sync(&bp->timer); | 1457 | del_timer_sync(&bp->timer); |
1448 | 1458 | ||
1449 | spin_lock_irq(&bp->lock); | 1459 | spin_lock_irq(&bp->lock); |
@@ -1453,13 +1463,14 @@ static int b44_close(struct net_device *dev) | |||
1453 | #endif | 1463 | #endif |
1454 | b44_halt(bp); | 1464 | b44_halt(bp); |
1455 | b44_free_rings(bp); | 1465 | b44_free_rings(bp); |
1456 | bp->flags &= ~B44_FLAG_INIT_COMPLETE; | ||
1457 | netif_carrier_off(bp->dev); | 1466 | netif_carrier_off(bp->dev); |
1458 | 1467 | ||
1459 | spin_unlock_irq(&bp->lock); | 1468 | spin_unlock_irq(&bp->lock); |
1460 | 1469 | ||
1461 | free_irq(dev->irq, dev); | 1470 | free_irq(dev->irq, dev); |
1462 | 1471 | ||
1472 | netif_poll_enable(dev); | ||
1473 | |||
1463 | b44_free_consistent(bp); | 1474 | b44_free_consistent(bp); |
1464 | 1475 | ||
1465 | return 0; | 1476 | return 0; |
@@ -1524,8 +1535,6 @@ static void __b44_set_rx_mode(struct net_device *dev) | |||
1524 | { | 1535 | { |
1525 | struct b44 *bp = netdev_priv(dev); | 1536 | struct b44 *bp = netdev_priv(dev); |
1526 | u32 val; | 1537 | u32 val; |
1527 | int i=0; | ||
1528 | unsigned char zero[6] = {0,0,0,0,0,0}; | ||
1529 | 1538 | ||
1530 | val = br32(bp, B44_RXCONFIG); | 1539 | val = br32(bp, B44_RXCONFIG); |
1531 | val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI); | 1540 | val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI); |
@@ -1533,14 +1542,17 @@ static void __b44_set_rx_mode(struct net_device *dev) | |||
1533 | val |= RXCONFIG_PROMISC; | 1542 | val |= RXCONFIG_PROMISC; |
1534 | bw32(bp, B44_RXCONFIG, val); | 1543 | bw32(bp, B44_RXCONFIG, val); |
1535 | } else { | 1544 | } else { |
1545 | unsigned char zero[6] = {0, 0, 0, 0, 0, 0}; | ||
1546 | int i = 0; | ||
1547 | |||
1536 | __b44_set_mac_addr(bp); | 1548 | __b44_set_mac_addr(bp); |
1537 | 1549 | ||
1538 | if (dev->flags & IFF_ALLMULTI) | 1550 | if (dev->flags & IFF_ALLMULTI) |
1539 | val |= RXCONFIG_ALLMULTI; | 1551 | val |= RXCONFIG_ALLMULTI; |
1540 | else | 1552 | else |
1541 | i=__b44_load_mcast(bp, dev); | 1553 | i = __b44_load_mcast(bp, dev); |
1542 | 1554 | ||
1543 | for(;i<64;i++) { | 1555 | for (; i < 64; i++) { |
1544 | __b44_cam_write(bp, zero, i); | 1556 | __b44_cam_write(bp, zero, i); |
1545 | } | 1557 | } |
1546 | bw32(bp, B44_RXCONFIG, val); | 1558 | bw32(bp, B44_RXCONFIG, val); |
@@ -1604,7 +1616,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1604 | { | 1616 | { |
1605 | struct b44 *bp = netdev_priv(dev); | 1617 | struct b44 *bp = netdev_priv(dev); |
1606 | 1618 | ||
1607 | if (!(bp->flags & B44_FLAG_INIT_COMPLETE)) | 1619 | if (!netif_running(dev)) |
1608 | return -EAGAIN; | 1620 | return -EAGAIN; |
1609 | cmd->supported = (SUPPORTED_Autoneg); | 1621 | cmd->supported = (SUPPORTED_Autoneg); |
1610 | cmd->supported |= (SUPPORTED_100baseT_Half | | 1622 | cmd->supported |= (SUPPORTED_100baseT_Half | |
@@ -1642,7 +1654,7 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1642 | { | 1654 | { |
1643 | struct b44 *bp = netdev_priv(dev); | 1655 | struct b44 *bp = netdev_priv(dev); |
1644 | 1656 | ||
1645 | if (!(bp->flags & B44_FLAG_INIT_COMPLETE)) | 1657 | if (!netif_running(dev)) |
1646 | return -EAGAIN; | 1658 | return -EAGAIN; |
1647 | 1659 | ||
1648 | /* We do not support gigabit. */ | 1660 | /* We do not support gigabit. */ |
@@ -1772,6 +1784,37 @@ static int b44_set_pauseparam(struct net_device *dev, | |||
1772 | return 0; | 1784 | return 0; |
1773 | } | 1785 | } |
1774 | 1786 | ||
1787 | static void b44_get_strings(struct net_device *dev, u32 stringset, u8 *data) | ||
1788 | { | ||
1789 | switch(stringset) { | ||
1790 | case ETH_SS_STATS: | ||
1791 | memcpy(data, *b44_gstrings, sizeof(b44_gstrings)); | ||
1792 | break; | ||
1793 | } | ||
1794 | } | ||
1795 | |||
1796 | static int b44_get_stats_count(struct net_device *dev) | ||
1797 | { | ||
1798 | return ARRAY_SIZE(b44_gstrings); | ||
1799 | } | ||
1800 | |||
1801 | static void b44_get_ethtool_stats(struct net_device *dev, | ||
1802 | struct ethtool_stats *stats, u64 *data) | ||
1803 | { | ||
1804 | struct b44 *bp = netdev_priv(dev); | ||
1805 | u32 *val = &bp->hw_stats.tx_good_octets; | ||
1806 | u32 i; | ||
1807 | |||
1808 | spin_lock_irq(&bp->lock); | ||
1809 | |||
1810 | b44_stats_update(bp); | ||
1811 | |||
1812 | for (i = 0; i < ARRAY_SIZE(b44_gstrings); i++) | ||
1813 | *data++ = *val++; | ||
1814 | |||
1815 | spin_unlock_irq(&bp->lock); | ||
1816 | } | ||
1817 | |||
1775 | static struct ethtool_ops b44_ethtool_ops = { | 1818 | static struct ethtool_ops b44_ethtool_ops = { |
1776 | .get_drvinfo = b44_get_drvinfo, | 1819 | .get_drvinfo = b44_get_drvinfo, |
1777 | .get_settings = b44_get_settings, | 1820 | .get_settings = b44_get_settings, |
@@ -1784,6 +1827,9 @@ static struct ethtool_ops b44_ethtool_ops = { | |||
1784 | .set_pauseparam = b44_set_pauseparam, | 1827 | .set_pauseparam = b44_set_pauseparam, |
1785 | .get_msglevel = b44_get_msglevel, | 1828 | .get_msglevel = b44_get_msglevel, |
1786 | .set_msglevel = b44_set_msglevel, | 1829 | .set_msglevel = b44_set_msglevel, |
1830 | .get_strings = b44_get_strings, | ||
1831 | .get_stats_count = b44_get_stats_count, | ||
1832 | .get_ethtool_stats = b44_get_ethtool_stats, | ||
1787 | .get_perm_addr = ethtool_op_get_perm_addr, | 1833 | .get_perm_addr = ethtool_op_get_perm_addr, |
1788 | }; | 1834 | }; |
1789 | 1835 | ||
@@ -1892,9 +1938,9 @@ static int __devinit b44_init_one(struct pci_dev *pdev, | |||
1892 | 1938 | ||
1893 | err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK); | 1939 | err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK); |
1894 | if (err) { | 1940 | if (err) { |
1895 | printk(KERN_ERR PFX "No usable DMA configuration, " | 1941 | printk(KERN_ERR PFX "No usable DMA configuration, " |
1896 | "aborting.\n"); | 1942 | "aborting.\n"); |
1897 | goto err_out_free_res; | 1943 | goto err_out_free_res; |
1898 | } | 1944 | } |
1899 | 1945 | ||
1900 | b44reg_base = pci_resource_start(pdev, 0); | 1946 | b44reg_base = pci_resource_start(pdev, 0); |
@@ -1916,10 +1962,8 @@ static int __devinit b44_init_one(struct pci_dev *pdev, | |||
1916 | bp = netdev_priv(dev); | 1962 | bp = netdev_priv(dev); |
1917 | bp->pdev = pdev; | 1963 | bp->pdev = pdev; |
1918 | bp->dev = dev; | 1964 | bp->dev = dev; |
1919 | if (b44_debug >= 0) | 1965 | |
1920 | bp->msg_enable = (1 << b44_debug) - 1; | 1966 | bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); |
1921 | else | ||
1922 | bp->msg_enable = B44_DEF_MSG_ENABLE; | ||
1923 | 1967 | ||
1924 | spin_lock_init(&bp->lock); | 1968 | spin_lock_init(&bp->lock); |
1925 | 1969 | ||
@@ -2009,17 +2053,14 @@ err_out_disable_pdev: | |||
2009 | static void __devexit b44_remove_one(struct pci_dev *pdev) | 2053 | static void __devexit b44_remove_one(struct pci_dev *pdev) |
2010 | { | 2054 | { |
2011 | struct net_device *dev = pci_get_drvdata(pdev); | 2055 | struct net_device *dev = pci_get_drvdata(pdev); |
2056 | struct b44 *bp = netdev_priv(dev); | ||
2012 | 2057 | ||
2013 | if (dev) { | 2058 | unregister_netdev(dev); |
2014 | struct b44 *bp = netdev_priv(dev); | 2059 | iounmap(bp->regs); |
2015 | 2060 | free_netdev(dev); | |
2016 | unregister_netdev(dev); | 2061 | pci_release_regions(pdev); |
2017 | iounmap(bp->regs); | 2062 | pci_disable_device(pdev); |
2018 | free_netdev(dev); | 2063 | pci_set_drvdata(pdev, NULL); |
2019 | pci_release_regions(pdev); | ||
2020 | pci_disable_device(pdev); | ||
2021 | pci_set_drvdata(pdev, NULL); | ||
2022 | } | ||
2023 | } | 2064 | } |
2024 | 2065 | ||
2025 | static int b44_suspend(struct pci_dev *pdev, pm_message_t state) | 2066 | static int b44_suspend(struct pci_dev *pdev, pm_message_t state) |
diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 593cb0ad4100..b178662978f3 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h | |||
@@ -346,29 +346,63 @@ struct ring_info { | |||
346 | 346 | ||
347 | #define B44_MCAST_TABLE_SIZE 32 | 347 | #define B44_MCAST_TABLE_SIZE 32 |
348 | 348 | ||
349 | #define B44_STAT_REG_DECLARE \ | ||
350 | _B44(tx_good_octets) \ | ||
351 | _B44(tx_good_pkts) \ | ||
352 | _B44(tx_octets) \ | ||
353 | _B44(tx_pkts) \ | ||
354 | _B44(tx_broadcast_pkts) \ | ||
355 | _B44(tx_multicast_pkts) \ | ||
356 | _B44(tx_len_64) \ | ||
357 | _B44(tx_len_65_to_127) \ | ||
358 | _B44(tx_len_128_to_255) \ | ||
359 | _B44(tx_len_256_to_511) \ | ||
360 | _B44(tx_len_512_to_1023) \ | ||
361 | _B44(tx_len_1024_to_max) \ | ||
362 | _B44(tx_jabber_pkts) \ | ||
363 | _B44(tx_oversize_pkts) \ | ||
364 | _B44(tx_fragment_pkts) \ | ||
365 | _B44(tx_underruns) \ | ||
366 | _B44(tx_total_cols) \ | ||
367 | _B44(tx_single_cols) \ | ||
368 | _B44(tx_multiple_cols) \ | ||
369 | _B44(tx_excessive_cols) \ | ||
370 | _B44(tx_late_cols) \ | ||
371 | _B44(tx_defered) \ | ||
372 | _B44(tx_carrier_lost) \ | ||
373 | _B44(tx_pause_pkts) \ | ||
374 | _B44(rx_good_octets) \ | ||
375 | _B44(rx_good_pkts) \ | ||
376 | _B44(rx_octets) \ | ||
377 | _B44(rx_pkts) \ | ||
378 | _B44(rx_broadcast_pkts) \ | ||
379 | _B44(rx_multicast_pkts) \ | ||
380 | _B44(rx_len_64) \ | ||
381 | _B44(rx_len_65_to_127) \ | ||
382 | _B44(rx_len_128_to_255) \ | ||
383 | _B44(rx_len_256_to_511) \ | ||
384 | _B44(rx_len_512_to_1023) \ | ||
385 | _B44(rx_len_1024_to_max) \ | ||
386 | _B44(rx_jabber_pkts) \ | ||
387 | _B44(rx_oversize_pkts) \ | ||
388 | _B44(rx_fragment_pkts) \ | ||
389 | _B44(rx_missed_pkts) \ | ||
390 | _B44(rx_crc_align_errs) \ | ||
391 | _B44(rx_undersize) \ | ||
392 | _B44(rx_crc_errs) \ | ||
393 | _B44(rx_align_errs) \ | ||
394 | _B44(rx_symbol_errs) \ | ||
395 | _B44(rx_pause_pkts) \ | ||
396 | _B44(rx_nonpause_pkts) | ||
397 | |||
349 | /* SW copy of device statistics, kept up to date by periodic timer | 398 | /* SW copy of device statistics, kept up to date by periodic timer |
350 | * which probes HW values. Must have same relative layout as HW | 399 | * which probes HW values. Check b44_stats_update if you mess with |
351 | * register above, because b44_stats_update depends upon this. | 400 | * the layout |
352 | */ | 401 | */ |
353 | struct b44_hw_stats { | 402 | struct b44_hw_stats { |
354 | u32 tx_good_octets, tx_good_pkts, tx_octets; | 403 | #define _B44(x) u32 x; |
355 | u32 tx_pkts, tx_broadcast_pkts, tx_multicast_pkts; | 404 | B44_STAT_REG_DECLARE |
356 | u32 tx_len_64, tx_len_65_to_127, tx_len_128_to_255; | 405 | #undef _B44 |
357 | u32 tx_len_256_to_511, tx_len_512_to_1023, tx_len_1024_to_max; | ||
358 | u32 tx_jabber_pkts, tx_oversize_pkts, tx_fragment_pkts; | ||
359 | u32 tx_underruns, tx_total_cols, tx_single_cols; | ||
360 | u32 tx_multiple_cols, tx_excessive_cols, tx_late_cols; | ||
361 | u32 tx_defered, tx_carrier_lost, tx_pause_pkts; | ||
362 | u32 __pad1[8]; | ||
363 | |||
364 | u32 rx_good_octets, rx_good_pkts, rx_octets; | ||
365 | u32 rx_pkts, rx_broadcast_pkts, rx_multicast_pkts; | ||
366 | u32 rx_len_64, rx_len_65_to_127, rx_len_128_to_255; | ||
367 | u32 rx_len_256_to_511, rx_len_512_to_1023, rx_len_1024_to_max; | ||
368 | u32 rx_jabber_pkts, rx_oversize_pkts, rx_fragment_pkts; | ||
369 | u32 rx_missed_pkts, rx_crc_align_errs, rx_undersize; | ||
370 | u32 rx_crc_errs, rx_align_errs, rx_symbol_errs; | ||
371 | u32 rx_pause_pkts, rx_nonpause_pkts; | ||
372 | }; | 406 | }; |
373 | 407 | ||
374 | struct b44 { | 408 | struct b44 { |
@@ -386,7 +420,6 @@ struct b44 { | |||
386 | 420 | ||
387 | u32 dma_offset; | 421 | u32 dma_offset; |
388 | u32 flags; | 422 | u32 flags; |
389 | #define B44_FLAG_INIT_COMPLETE 0x00000001 | ||
390 | #define B44_FLAG_BUGGY_TXPTR 0x00000002 | 423 | #define B44_FLAG_BUGGY_TXPTR 0x00000002 |
391 | #define B44_FLAG_REORDER_BUG 0x00000004 | 424 | #define B44_FLAG_REORDER_BUG 0x00000004 |
392 | #define B44_FLAG_PAUSE_AUTO 0x00008000 | 425 | #define B44_FLAG_PAUSE_AUTO 0x00008000 |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 8032126fd589..94cec3cf2a13 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1604,35 +1604,27 @@ static int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_ | |||
1604 | (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) | 1604 | (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) |
1605 | 1605 | ||
1606 | /* | 1606 | /* |
1607 | * Compute the features available to the bonding device by | 1607 | * Compute the common dev->feature set available to all slaves. Some |
1608 | * intersection of all of the slave devices' BOND_INTERSECT_FEATURES. | 1608 | * feature bits are managed elsewhere, so preserve feature bits set on |
1609 | * Call this after attaching or detaching a slave to update the | 1609 | * master device that are not part of the examined set. |
1610 | * bond's features. | ||
1611 | */ | 1610 | */ |
1612 | static int bond_compute_features(struct bonding *bond) | 1611 | static int bond_compute_features(struct bonding *bond) |
1613 | { | 1612 | { |
1614 | int i; | 1613 | unsigned long features = BOND_INTERSECT_FEATURES; |
1615 | struct slave *slave; | 1614 | struct slave *slave; |
1616 | struct net_device *bond_dev = bond->dev; | 1615 | struct net_device *bond_dev = bond->dev; |
1617 | int features = bond->bond_features; | 1616 | int i; |
1618 | 1617 | ||
1619 | bond_for_each_slave(bond, slave, i) { | 1618 | bond_for_each_slave(bond, slave, i) |
1620 | struct net_device * slave_dev = slave->dev; | 1619 | features &= (slave->dev->features & BOND_INTERSECT_FEATURES); |
1621 | if (i == 0) { | ||
1622 | features |= BOND_INTERSECT_FEATURES; | ||
1623 | } | ||
1624 | features &= | ||
1625 | ~(~slave_dev->features & BOND_INTERSECT_FEATURES); | ||
1626 | } | ||
1627 | 1620 | ||
1628 | /* turn off NETIF_F_SG if we need a csum and h/w can't do it */ | ||
1629 | if ((features & NETIF_F_SG) && | 1621 | if ((features & NETIF_F_SG) && |
1630 | !(features & (NETIF_F_IP_CSUM | | 1622 | !(features & (NETIF_F_IP_CSUM | |
1631 | NETIF_F_NO_CSUM | | 1623 | NETIF_F_NO_CSUM | |
1632 | NETIF_F_HW_CSUM))) { | 1624 | NETIF_F_HW_CSUM))) |
1633 | features &= ~NETIF_F_SG; | 1625 | features &= ~NETIF_F_SG; |
1634 | } | ||
1635 | 1626 | ||
1627 | features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); | ||
1636 | bond_dev->features = features; | 1628 | bond_dev->features = features; |
1637 | 1629 | ||
1638 | return 0; | 1630 | return 0; |
@@ -4561,8 +4553,6 @@ static int __init bond_init(struct net_device *bond_dev, struct bond_params *par | |||
4561 | NETIF_F_HW_VLAN_RX | | 4553 | NETIF_F_HW_VLAN_RX | |
4562 | NETIF_F_HW_VLAN_FILTER); | 4554 | NETIF_F_HW_VLAN_FILTER); |
4563 | 4555 | ||
4564 | bond->bond_features = bond_dev->features; | ||
4565 | |||
4566 | #ifdef CONFIG_PROC_FS | 4556 | #ifdef CONFIG_PROC_FS |
4567 | bond_create_proc_entry(bond); | 4557 | bond_create_proc_entry(bond); |
4568 | #endif | 4558 | #endif |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index bbf9da8af624..1433e91db0f7 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -40,8 +40,8 @@ | |||
40 | #include "bond_3ad.h" | 40 | #include "bond_3ad.h" |
41 | #include "bond_alb.h" | 41 | #include "bond_alb.h" |
42 | 42 | ||
43 | #define DRV_VERSION "2.6.4" | 43 | #define DRV_VERSION "2.6.5" |
44 | #define DRV_RELDATE "September 26, 2005" | 44 | #define DRV_RELDATE "November 4, 2005" |
45 | #define DRV_NAME "bonding" | 45 | #define DRV_NAME "bonding" |
46 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | 46 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" |
47 | 47 | ||
@@ -211,9 +211,6 @@ struct bonding { | |||
211 | struct bond_params params; | 211 | struct bond_params params; |
212 | struct list_head vlan_list; | 212 | struct list_head vlan_list; |
213 | struct vlan_group *vlgrp; | 213 | struct vlan_group *vlgrp; |
214 | /* the features the bonding device supports, independently | ||
215 | * of any slaves */ | ||
216 | int bond_features; | ||
217 | }; | 214 | }; |
218 | 215 | ||
219 | /** | 216 | /** |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index b68b9cad76e9..64105e4eaf31 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -409,7 +409,6 @@ static irqreturn_t e100nw_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
409 | static void e100_rx(struct net_device *dev); | 409 | static void e100_rx(struct net_device *dev); |
410 | static int e100_close(struct net_device *dev); | 410 | static int e100_close(struct net_device *dev); |
411 | static int e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | 411 | static int e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); |
412 | static int e100_ethtool_ioctl(struct net_device* dev, struct ifreq *ifr); | ||
413 | static int e100_set_config(struct net_device* dev, struct ifmap* map); | 412 | static int e100_set_config(struct net_device* dev, struct ifmap* map); |
414 | static void e100_tx_timeout(struct net_device *dev); | 413 | static void e100_tx_timeout(struct net_device *dev); |
415 | static struct net_device_stats *e100_get_stats(struct net_device *dev); | 414 | static struct net_device_stats *e100_get_stats(struct net_device *dev); |
@@ -436,6 +435,8 @@ static void e100_reset_transceiver(struct net_device* net); | |||
436 | static void e100_clear_network_leds(unsigned long dummy); | 435 | static void e100_clear_network_leds(unsigned long dummy); |
437 | static void e100_set_network_leds(int active); | 436 | static void e100_set_network_leds(int active); |
438 | 437 | ||
438 | static struct ethtool_ops e100_ethtool_ops; | ||
439 | |||
439 | static void broadcom_check_speed(struct net_device* dev); | 440 | static void broadcom_check_speed(struct net_device* dev); |
440 | static void broadcom_check_duplex(struct net_device* dev); | 441 | static void broadcom_check_duplex(struct net_device* dev); |
441 | static void tdk_check_speed(struct net_device* dev); | 442 | static void tdk_check_speed(struct net_device* dev); |
@@ -495,6 +496,7 @@ etrax_ethernet_init(void) | |||
495 | dev->get_stats = e100_get_stats; | 496 | dev->get_stats = e100_get_stats; |
496 | dev->set_multicast_list = set_multicast_list; | 497 | dev->set_multicast_list = set_multicast_list; |
497 | dev->set_mac_address = e100_set_mac_address; | 498 | dev->set_mac_address = e100_set_mac_address; |
499 | dev->ethtool_ops = &e100_ethtool_ops; | ||
498 | dev->do_ioctl = e100_ioctl; | 500 | dev->do_ioctl = e100_ioctl; |
499 | dev->set_config = e100_set_config; | 501 | dev->set_config = e100_set_config; |
500 | dev->tx_timeout = e100_tx_timeout; | 502 | dev->tx_timeout = e100_tx_timeout; |
@@ -1448,8 +1450,6 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1448 | 1450 | ||
1449 | spin_lock(&np->lock); /* Preempt protection */ | 1451 | spin_lock(&np->lock); /* Preempt protection */ |
1450 | switch (cmd) { | 1452 | switch (cmd) { |
1451 | case SIOCETHTOOL: | ||
1452 | return e100_ethtool_ioctl(dev,ifr); | ||
1453 | case SIOCGMIIPHY: /* Get PHY address */ | 1453 | case SIOCGMIIPHY: /* Get PHY address */ |
1454 | data->phy_id = mdio_phy_addr; | 1454 | data->phy_id = mdio_phy_addr; |
1455 | break; | 1455 | break; |
@@ -1486,88 +1486,81 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1486 | return 0; | 1486 | return 0; |
1487 | } | 1487 | } |
1488 | 1488 | ||
1489 | static int | 1489 | static int e100_set_settings(struct net_device *dev, |
1490 | e100_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr) | 1490 | struct ethtool_cmd *ecmd) |
1491 | { | 1491 | { |
1492 | struct ethtool_cmd ecmd; | 1492 | ecmd->supported = SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | |
1493 | |||
1494 | if (copy_from_user(&ecmd, ifr->ifr_data, sizeof (ecmd))) | ||
1495 | return -EFAULT; | ||
1496 | |||
1497 | switch (ecmd.cmd) { | ||
1498 | case ETHTOOL_GSET: | ||
1499 | { | ||
1500 | memset((void *) &ecmd, 0, sizeof (ecmd)); | ||
1501 | ecmd.supported = | ||
1502 | SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | | ||
1503 | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | | 1493 | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | |
1504 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; | 1494 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; |
1505 | ecmd.port = PORT_TP; | 1495 | ecmd->port = PORT_TP; |
1506 | ecmd.transceiver = XCVR_EXTERNAL; | 1496 | ecmd->transceiver = XCVR_EXTERNAL; |
1507 | ecmd.phy_address = mdio_phy_addr; | 1497 | ecmd->phy_address = mdio_phy_addr; |
1508 | ecmd.speed = current_speed; | 1498 | ecmd->speed = current_speed; |
1509 | ecmd.duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; | 1499 | ecmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; |
1510 | ecmd.advertising = ADVERTISED_TP; | 1500 | ecmd->advertising = ADVERTISED_TP; |
1511 | if (current_duplex == autoneg && current_speed_selection == 0) | 1501 | |
1512 | ecmd.advertising |= ADVERTISED_Autoneg; | 1502 | if (current_duplex == autoneg && current_speed_selection == 0) |
1513 | else { | 1503 | ecmd->advertising |= ADVERTISED_Autoneg; |
1514 | ecmd.advertising |= | 1504 | else { |
1515 | ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | 1505 | ecmd->advertising |= |
1516 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; | 1506 | ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | |
1517 | if (current_speed_selection == 10) | 1507 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; |
1518 | ecmd.advertising &= ~(ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full); | 1508 | if (current_speed_selection == 10) |
1519 | else if (current_speed_selection == 100) | 1509 | ecmd->advertising &= ~(ADVERTISED_100baseT_Half | |
1520 | ecmd.advertising &= ~(ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full); | 1510 | ADVERTISED_100baseT_Full); |
1521 | if (current_duplex == half) | 1511 | else if (current_speed_selection == 100) |
1522 | ecmd.advertising &= ~(ADVERTISED_10baseT_Full | ADVERTISED_100baseT_Full); | 1512 | ecmd->advertising &= ~(ADVERTISED_10baseT_Half | |
1523 | else if (current_duplex == full) | 1513 | ADVERTISED_10baseT_Full); |
1524 | ecmd.advertising &= ~(ADVERTISED_10baseT_Half | ADVERTISED_100baseT_Half); | 1514 | if (current_duplex == half) |
1525 | } | 1515 | ecmd->advertising &= ~(ADVERTISED_10baseT_Full | |
1526 | ecmd.autoneg = AUTONEG_ENABLE; | 1516 | ADVERTISED_100baseT_Full); |
1527 | if (copy_to_user(ifr->ifr_data, &ecmd, sizeof (ecmd))) | 1517 | else if (current_duplex == full) |
1528 | return -EFAULT; | 1518 | ecmd->advertising &= ~(ADVERTISED_10baseT_Half | |
1529 | } | 1519 | ADVERTISED_100baseT_Half); |
1530 | break; | 1520 | } |
1531 | case ETHTOOL_SSET: | 1521 | |
1532 | { | 1522 | ecmd->autoneg = AUTONEG_ENABLE; |
1533 | if (!capable(CAP_NET_ADMIN)) { | 1523 | return 0; |
1534 | return -EPERM; | 1524 | } |
1535 | } | 1525 | |
1536 | if (ecmd.autoneg == AUTONEG_ENABLE) { | 1526 | static int e100_set_settings(struct net_device *dev, |
1537 | e100_set_duplex(dev, autoneg); | 1527 | struct ethtool_cmd *ecmd) |
1538 | e100_set_speed(dev, 0); | 1528 | { |
1539 | } else { | 1529 | if (ecmd->autoneg == AUTONEG_ENABLE) { |
1540 | e100_set_duplex(dev, ecmd.duplex == DUPLEX_HALF ? half : full); | 1530 | e100_set_duplex(dev, autoneg); |
1541 | e100_set_speed(dev, ecmd.speed == SPEED_10 ? 10: 100); | 1531 | e100_set_speed(dev, 0); |
1542 | } | 1532 | } else { |
1543 | } | 1533 | e100_set_duplex(dev, ecmd->duplex == DUPLEX_HALF ? half : full); |
1544 | break; | 1534 | e100_set_speed(dev, ecmd->speed == SPEED_10 ? 10: 100); |
1545 | case ETHTOOL_GDRVINFO: | ||
1546 | { | ||
1547 | struct ethtool_drvinfo info; | ||
1548 | memset((void *) &info, 0, sizeof (info)); | ||
1549 | strncpy(info.driver, "ETRAX 100LX", sizeof(info.driver) - 1); | ||
1550 | strncpy(info.version, "$Revision: 1.31 $", sizeof(info.version) - 1); | ||
1551 | strncpy(info.fw_version, "N/A", sizeof(info.fw_version) - 1); | ||
1552 | strncpy(info.bus_info, "N/A", sizeof(info.bus_info) - 1); | ||
1553 | info.regdump_len = 0; | ||
1554 | info.eedump_len = 0; | ||
1555 | info.testinfo_len = 0; | ||
1556 | if (copy_to_user(ifr->ifr_data, &info, sizeof (info))) | ||
1557 | return -EFAULT; | ||
1558 | } | ||
1559 | break; | ||
1560 | case ETHTOOL_NWAY_RST: | ||
1561 | if (current_duplex == autoneg && current_speed_selection == 0) | ||
1562 | e100_negotiate(dev); | ||
1563 | break; | ||
1564 | default: | ||
1565 | return -EOPNOTSUPP; | ||
1566 | break; | ||
1567 | } | 1535 | } |
1536 | |||
1537 | return 0; | ||
1538 | } | ||
1539 | |||
1540 | static void e100_get_drvinfo(struct net_device *dev, | ||
1541 | struct ethtool_drvinfo *info) | ||
1542 | { | ||
1543 | strncpy(info->driver, "ETRAX 100LX", sizeof(info->driver) - 1); | ||
1544 | strncpy(info->version, "$Revision: 1.31 $", sizeof(info->version) - 1); | ||
1545 | strncpy(info->fw_version, "N/A", sizeof(info->fw_version) - 1); | ||
1546 | strncpy(info->bus_info, "N/A", sizeof(info->bus_info) - 1); | ||
1547 | } | ||
1548 | |||
1549 | static int e100_nway_reset(struct net_device *dev) | ||
1550 | { | ||
1551 | if (current_duplex == autoneg && current_speed_selection == 0) | ||
1552 | e100_negotiate(dev); | ||
1568 | return 0; | 1553 | return 0; |
1569 | } | 1554 | } |
1570 | 1555 | ||
1556 | static struct ethtool_ops e100_ethtool_ops = { | ||
1557 | .get_settings = e100_get_settings, | ||
1558 | .set_settings = e100_set_settings, | ||
1559 | .get_drvinfo = e100_get_drvinfo, | ||
1560 | .nway_reset = e100_nway_reset, | ||
1561 | .get_link = ethtool_op_get_link, | ||
1562 | }; | ||
1563 | |||
1571 | static int | 1564 | static int |
1572 | e100_set_config(struct net_device *dev, struct ifmap *map) | 1565 | e100_set_config(struct net_device *dev, struct ifmap *map) |
1573 | { | 1566 | { |
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 7809838e6c4c..2a290cc397ad 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c | |||
@@ -1549,7 +1549,7 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwitch operating mode (1: switch, 2: multi- | |||
1549 | static int __init dgrs_init_module (void) | 1549 | static int __init dgrs_init_module (void) |
1550 | { | 1550 | { |
1551 | int i; | 1551 | int i; |
1552 | int eisacount = 0, pcicount = 0; | 1552 | int cardcount = 0; |
1553 | 1553 | ||
1554 | /* | 1554 | /* |
1555 | * Command line variable overrides | 1555 | * Command line variable overrides |
@@ -1591,15 +1591,13 @@ static int __init dgrs_init_module (void) | |||
1591 | * Find and configure all the cards | 1591 | * Find and configure all the cards |
1592 | */ | 1592 | */ |
1593 | #ifdef CONFIG_EISA | 1593 | #ifdef CONFIG_EISA |
1594 | eisacount = eisa_driver_register(&dgrs_eisa_driver); | 1594 | cardcount = eisa_driver_register(&dgrs_eisa_driver); |
1595 | if (eisacount < 0) | 1595 | if (cardcount < 0) |
1596 | return eisacount; | 1596 | return cardcount; |
1597 | #endif | ||
1598 | #ifdef CONFIG_PCI | ||
1599 | pcicount = pci_register_driver(&dgrs_pci_driver); | ||
1600 | if (pcicount) | ||
1601 | return pcicount; | ||
1602 | #endif | 1597 | #endif |
1598 | cardcount = pci_register_driver(&dgrs_pci_driver); | ||
1599 | if (cardcount) | ||
1600 | return cardcount; | ||
1603 | return 0; | 1601 | return 0; |
1604 | } | 1602 | } |
1605 | 1603 | ||
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index eb169a8e8773..7a6aeae2c9fa 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1478,7 +1478,7 @@ static inline int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1478 | 1478 | ||
1479 | if(pci_dma_mapping_error(rx->dma_addr)) { | 1479 | if(pci_dma_mapping_error(rx->dma_addr)) { |
1480 | dev_kfree_skb_any(rx->skb); | 1480 | dev_kfree_skb_any(rx->skb); |
1481 | rx->skb = 0; | 1481 | rx->skb = NULL; |
1482 | rx->dma_addr = 0; | 1482 | rx->dma_addr = 0; |
1483 | return -ENOMEM; | 1483 | return -ENOMEM; |
1484 | } | 1484 | } |
@@ -1764,7 +1764,7 @@ static int e100_up(struct nic *nic) | |||
1764 | if((err = e100_hw_init(nic))) | 1764 | if((err = e100_hw_init(nic))) |
1765 | goto err_clean_cbs; | 1765 | goto err_clean_cbs; |
1766 | e100_set_multicast_list(nic->netdev); | 1766 | e100_set_multicast_list(nic->netdev); |
1767 | e100_start_receiver(nic, 0); | 1767 | e100_start_receiver(nic, NULL); |
1768 | mod_timer(&nic->watchdog, jiffies); | 1768 | mod_timer(&nic->watchdog, jiffies); |
1769 | if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, | 1769 | if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, |
1770 | nic->netdev->name, nic->netdev))) | 1770 | nic->netdev->name, nic->netdev))) |
@@ -1844,7 +1844,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) | |||
1844 | mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, | 1844 | mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, |
1845 | BMCR_LOOPBACK); | 1845 | BMCR_LOOPBACK); |
1846 | 1846 | ||
1847 | e100_start_receiver(nic, 0); | 1847 | e100_start_receiver(nic, NULL); |
1848 | 1848 | ||
1849 | if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) { | 1849 | if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) { |
1850 | err = -ENOMEM; | 1850 | err = -ENOMEM; |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index a3c3fc9c0d8a..f857ae94d261 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -110,7 +110,6 @@ | |||
110 | #include <linux/init.h> | 110 | #include <linux/init.h> |
111 | #include <linux/ip.h> /* for iph */ | 111 | #include <linux/ip.h> /* for iph */ |
112 | #include <linux/in.h> /* for IPPROTO_... */ | 112 | #include <linux/in.h> /* for IPPROTO_... */ |
113 | #include <linux/eeprom.h> | ||
114 | #include <linux/compiler.h> | 113 | #include <linux/compiler.h> |
115 | #include <linux/prefetch.h> | 114 | #include <linux/prefetch.h> |
116 | #include <linux/ethtool.h> | 115 | #include <linux/ethtool.h> |
@@ -445,7 +444,6 @@ struct ns83820 { | |||
445 | 444 | ||
446 | u32 MEAR_cache; | 445 | u32 MEAR_cache; |
447 | u32 IMR_cache; | 446 | u32 IMR_cache; |
448 | struct eeprom ee; | ||
449 | 447 | ||
450 | unsigned linkstate; | 448 | unsigned linkstate; |
451 | 449 | ||
@@ -1558,15 +1556,13 @@ static void ns83820_getmac(struct ns83820 *dev, u8 *mac) | |||
1558 | unsigned i; | 1556 | unsigned i; |
1559 | for (i=0; i<3; i++) { | 1557 | for (i=0; i<3; i++) { |
1560 | u32 data; | 1558 | u32 data; |
1561 | #if 0 /* I've left this in as an example of how to use eeprom.h */ | 1559 | |
1562 | data = eeprom_readw(&dev->ee, 0xa + 2 - i); | ||
1563 | #else | ||
1564 | /* Read from the perfect match memory: this is loaded by | 1560 | /* Read from the perfect match memory: this is loaded by |
1565 | * the chip from the EEPROM via the EELOAD self test. | 1561 | * the chip from the EEPROM via the EELOAD self test. |
1566 | */ | 1562 | */ |
1567 | writel(i*2, dev->base + RFCR); | 1563 | writel(i*2, dev->base + RFCR); |
1568 | data = readl(dev->base + RFDR); | 1564 | data = readl(dev->base + RFDR); |
1569 | #endif | 1565 | |
1570 | *mac++ = data; | 1566 | *mac++ = data; |
1571 | *mac++ = data >> 8; | 1567 | *mac++ = data >> 8; |
1572 | } | 1568 | } |
@@ -1851,8 +1847,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ | |||
1851 | spin_lock_init(&dev->misc_lock); | 1847 | spin_lock_init(&dev->misc_lock); |
1852 | dev->pci_dev = pci_dev; | 1848 | dev->pci_dev = pci_dev; |
1853 | 1849 | ||
1854 | dev->ee.cache = &dev->MEAR_cache; | ||
1855 | dev->ee.lock = &dev->misc_lock; | ||
1856 | SET_MODULE_OWNER(ndev); | 1850 | SET_MODULE_OWNER(ndev); |
1857 | SET_NETDEV_DEV(ndev, &pci_dev->dev); | 1851 | SET_NETDEV_DEV(ndev, &pci_dev->dev); |
1858 | 1852 | ||
@@ -1887,9 +1881,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ | |||
1887 | 1881 | ||
1888 | dev->IMR_cache = 0; | 1882 | dev->IMR_cache = 0; |
1889 | 1883 | ||
1890 | setup_ee_mem_bitbanger(&dev->ee, dev->base + MEAR, 3, 2, 1, 0, | ||
1891 | 0); | ||
1892 | |||
1893 | err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, | 1884 | err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, |
1894 | DRV_NAME, ndev); | 1885 | DRV_NAME, ndev); |
1895 | if (err) { | 1886 | if (err) { |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 8e41f4cea272..e57df8dfe6b4 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -1531,7 +1531,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1531 | #define LINK_UP_DOWN_INTERRUPT 1 | 1531 | #define LINK_UP_DOWN_INTERRUPT 1 |
1532 | #define MAC_RMAC_ERR_TIMER 2 | 1532 | #define MAC_RMAC_ERR_TIMER 2 |
1533 | 1533 | ||
1534 | int s2io_link_fault_indication(nic_t *nic) | 1534 | static int s2io_link_fault_indication(nic_t *nic) |
1535 | { | 1535 | { |
1536 | if (nic->intr_type != INTA) | 1536 | if (nic->intr_type != INTA) |
1537 | return MAC_RMAC_ERR_TIMER; | 1537 | return MAC_RMAC_ERR_TIMER; |
@@ -1863,7 +1863,7 @@ static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag) | |||
1863 | * | 1863 | * |
1864 | */ | 1864 | */ |
1865 | 1865 | ||
1866 | void fix_mac_address(nic_t * sp) | 1866 | static void fix_mac_address(nic_t * sp) |
1867 | { | 1867 | { |
1868 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 1868 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
1869 | u64 val64; | 1869 | u64 val64; |
@@ -2159,7 +2159,7 @@ int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb) | |||
2159 | * SUCCESS on success or an appropriate -ve value on failure. | 2159 | * SUCCESS on success or an appropriate -ve value on failure. |
2160 | */ | 2160 | */ |
2161 | 2161 | ||
2162 | int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | 2162 | static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) |
2163 | { | 2163 | { |
2164 | struct net_device *dev = nic->dev; | 2164 | struct net_device *dev = nic->dev; |
2165 | struct sk_buff *skb; | 2165 | struct sk_buff *skb; |
@@ -2830,7 +2830,7 @@ static void alarm_intr_handler(struct s2io_nic *nic) | |||
2830 | * SUCCESS on success and FAILURE on failure. | 2830 | * SUCCESS on success and FAILURE on failure. |
2831 | */ | 2831 | */ |
2832 | 2832 | ||
2833 | int wait_for_cmd_complete(nic_t * sp) | 2833 | static int wait_for_cmd_complete(nic_t * sp) |
2834 | { | 2834 | { |
2835 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 2835 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
2836 | int ret = FAILURE, cnt = 0; | 2836 | int ret = FAILURE, cnt = 0; |
@@ -3076,7 +3076,7 @@ int s2io_set_swapper(nic_t * sp) | |||
3076 | return SUCCESS; | 3076 | return SUCCESS; |
3077 | } | 3077 | } |
3078 | 3078 | ||
3079 | int wait_for_msix_trans(nic_t *nic, int i) | 3079 | static int wait_for_msix_trans(nic_t *nic, int i) |
3080 | { | 3080 | { |
3081 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | 3081 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3082 | u64 val64; | 3082 | u64 val64; |
@@ -3115,7 +3115,7 @@ void restore_xmsi_data(nic_t *nic) | |||
3115 | } | 3115 | } |
3116 | } | 3116 | } |
3117 | 3117 | ||
3118 | void store_xmsi_data(nic_t *nic) | 3118 | static void store_xmsi_data(nic_t *nic) |
3119 | { | 3119 | { |
3120 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | 3120 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3121 | u64 val64, addr, data; | 3121 | u64 val64, addr, data; |
@@ -3287,7 +3287,7 @@ int s2io_enable_msi_x(nic_t *nic) | |||
3287 | * file on failure. | 3287 | * file on failure. |
3288 | */ | 3288 | */ |
3289 | 3289 | ||
3290 | int s2io_open(struct net_device *dev) | 3290 | static int s2io_open(struct net_device *dev) |
3291 | { | 3291 | { |
3292 | nic_t *sp = dev->priv; | 3292 | nic_t *sp = dev->priv; |
3293 | int err = 0; | 3293 | int err = 0; |
@@ -3417,7 +3417,7 @@ hw_init_failed: | |||
3417 | * file on failure. | 3417 | * file on failure. |
3418 | */ | 3418 | */ |
3419 | 3419 | ||
3420 | int s2io_close(struct net_device *dev) | 3420 | static int s2io_close(struct net_device *dev) |
3421 | { | 3421 | { |
3422 | nic_t *sp = dev->priv; | 3422 | nic_t *sp = dev->priv; |
3423 | int i; | 3423 | int i; |
@@ -3466,7 +3466,7 @@ int s2io_close(struct net_device *dev) | |||
3466 | * 0 on success & 1 on failure. | 3466 | * 0 on success & 1 on failure. |
3467 | */ | 3467 | */ |
3468 | 3468 | ||
3469 | int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | 3469 | static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) |
3470 | { | 3470 | { |
3471 | nic_t *sp = dev->priv; | 3471 | nic_t *sp = dev->priv; |
3472 | u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; | 3472 | u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; |
@@ -3912,7 +3912,7 @@ static void s2io_updt_stats(nic_t *sp) | |||
3912 | * pointer to the updated net_device_stats structure. | 3912 | * pointer to the updated net_device_stats structure. |
3913 | */ | 3913 | */ |
3914 | 3914 | ||
3915 | struct net_device_stats *s2io_get_stats(struct net_device *dev) | 3915 | static struct net_device_stats *s2io_get_stats(struct net_device *dev) |
3916 | { | 3916 | { |
3917 | nic_t *sp = dev->priv; | 3917 | nic_t *sp = dev->priv; |
3918 | mac_info_t *mac_control; | 3918 | mac_info_t *mac_control; |
@@ -5105,19 +5105,20 @@ static void s2io_get_ethtool_stats(struct net_device *dev, | |||
5105 | tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; | 5105 | tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; |
5106 | } | 5106 | } |
5107 | 5107 | ||
5108 | int s2io_ethtool_get_regs_len(struct net_device *dev) | 5108 | static int s2io_ethtool_get_regs_len(struct net_device *dev) |
5109 | { | 5109 | { |
5110 | return (XENA_REG_SPACE); | 5110 | return (XENA_REG_SPACE); |
5111 | } | 5111 | } |
5112 | 5112 | ||
5113 | 5113 | ||
5114 | u32 s2io_ethtool_get_rx_csum(struct net_device * dev) | 5114 | static u32 s2io_ethtool_get_rx_csum(struct net_device * dev) |
5115 | { | 5115 | { |
5116 | nic_t *sp = dev->priv; | 5116 | nic_t *sp = dev->priv; |
5117 | 5117 | ||
5118 | return (sp->rx_csum); | 5118 | return (sp->rx_csum); |
5119 | } | 5119 | } |
5120 | int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) | 5120 | |
5121 | static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) | ||
5121 | { | 5122 | { |
5122 | nic_t *sp = dev->priv; | 5123 | nic_t *sp = dev->priv; |
5123 | 5124 | ||
@@ -5128,17 +5129,19 @@ int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) | |||
5128 | 5129 | ||
5129 | return 0; | 5130 | return 0; |
5130 | } | 5131 | } |
5131 | int s2io_get_eeprom_len(struct net_device *dev) | 5132 | |
5133 | static int s2io_get_eeprom_len(struct net_device *dev) | ||
5132 | { | 5134 | { |
5133 | return (XENA_EEPROM_SPACE); | 5135 | return (XENA_EEPROM_SPACE); |
5134 | } | 5136 | } |
5135 | 5137 | ||
5136 | int s2io_ethtool_self_test_count(struct net_device *dev) | 5138 | static int s2io_ethtool_self_test_count(struct net_device *dev) |
5137 | { | 5139 | { |
5138 | return (S2IO_TEST_LEN); | 5140 | return (S2IO_TEST_LEN); |
5139 | } | 5141 | } |
5140 | void s2io_ethtool_get_strings(struct net_device *dev, | 5142 | |
5141 | u32 stringset, u8 * data) | 5143 | static void s2io_ethtool_get_strings(struct net_device *dev, |
5144 | u32 stringset, u8 * data) | ||
5142 | { | 5145 | { |
5143 | switch (stringset) { | 5146 | switch (stringset) { |
5144 | case ETH_SS_TEST: | 5147 | case ETH_SS_TEST: |
@@ -5154,7 +5157,7 @@ static int s2io_ethtool_get_stats_count(struct net_device *dev) | |||
5154 | return (S2IO_STAT_LEN); | 5157 | return (S2IO_STAT_LEN); |
5155 | } | 5158 | } |
5156 | 5159 | ||
5157 | int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) | 5160 | static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) |
5158 | { | 5161 | { |
5159 | if (data) | 5162 | if (data) |
5160 | dev->features |= NETIF_F_IP_CSUM; | 5163 | dev->features |= NETIF_F_IP_CSUM; |
@@ -5207,7 +5210,7 @@ static struct ethtool_ops netdev_ethtool_ops = { | |||
5207 | * function always return EOPNOTSUPPORTED | 5210 | * function always return EOPNOTSUPPORTED |
5208 | */ | 5211 | */ |
5209 | 5212 | ||
5210 | int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 5213 | static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
5211 | { | 5214 | { |
5212 | return -EOPNOTSUPP; | 5215 | return -EOPNOTSUPP; |
5213 | } | 5216 | } |
@@ -5223,7 +5226,7 @@ int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
5223 | * file on failure. | 5226 | * file on failure. |
5224 | */ | 5227 | */ |
5225 | 5228 | ||
5226 | int s2io_change_mtu(struct net_device *dev, int new_mtu) | 5229 | static int s2io_change_mtu(struct net_device *dev, int new_mtu) |
5227 | { | 5230 | { |
5228 | nic_t *sp = dev->priv; | 5231 | nic_t *sp = dev->priv; |
5229 | 5232 | ||
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 572f121b1f4e..596c93b12daa 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -37,12 +37,13 @@ | |||
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/crc32.h> | 38 | #include <linux/crc32.h> |
39 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
40 | #include <linux/mii.h> | ||
40 | #include <asm/irq.h> | 41 | #include <asm/irq.h> |
41 | 42 | ||
42 | #include "skge.h" | 43 | #include "skge.h" |
43 | 44 | ||
44 | #define DRV_NAME "skge" | 45 | #define DRV_NAME "skge" |
45 | #define DRV_VERSION "1.1" | 46 | #define DRV_VERSION "1.2" |
46 | #define PFX DRV_NAME " " | 47 | #define PFX DRV_NAME " " |
47 | 48 | ||
48 | #define DEFAULT_TX_RING_SIZE 128 | 49 | #define DEFAULT_TX_RING_SIZE 128 |
@@ -88,8 +89,8 @@ MODULE_DEVICE_TABLE(pci, skge_id_table); | |||
88 | static int skge_up(struct net_device *dev); | 89 | static int skge_up(struct net_device *dev); |
89 | static int skge_down(struct net_device *dev); | 90 | static int skge_down(struct net_device *dev); |
90 | static void skge_tx_clean(struct skge_port *skge); | 91 | static void skge_tx_clean(struct skge_port *skge); |
91 | static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); | 92 | static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); |
92 | static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); | 93 | static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); |
93 | static void genesis_get_stats(struct skge_port *skge, u64 *data); | 94 | static void genesis_get_stats(struct skge_port *skge, u64 *data); |
94 | static void yukon_get_stats(struct skge_port *skge, u64 *data); | 95 | static void yukon_get_stats(struct skge_port *skge, u64 *data); |
95 | static void yukon_init(struct skge_hw *hw, int port); | 96 | static void yukon_init(struct skge_hw *hw, int port); |
@@ -129,7 +130,7 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
129 | regs->len - B3_RI_WTO_R1); | 130 | regs->len - B3_RI_WTO_R1); |
130 | } | 131 | } |
131 | 132 | ||
132 | /* Wake on Lan only supported on Yukon chps with rev 1 or above */ | 133 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ |
133 | static int wol_supported(const struct skge_hw *hw) | 134 | static int wol_supported(const struct skge_hw *hw) |
134 | { | 135 | { |
135 | return !((hw->chip_id == CHIP_ID_GENESIS || | 136 | return !((hw->chip_id == CHIP_ID_GENESIS || |
@@ -169,8 +170,8 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
169 | return 0; | 170 | return 0; |
170 | } | 171 | } |
171 | 172 | ||
172 | /* Determine supported/adverised modes based on hardware. | 173 | /* Determine supported/advertised modes based on hardware. |
173 | * Note: ethtoool ADVERTISED_xxx == SUPPORTED_xxx | 174 | * Note: ethtool ADVERTISED_xxx == SUPPORTED_xxx |
174 | */ | 175 | */ |
175 | static u32 skge_supported_modes(const struct skge_hw *hw) | 176 | static u32 skge_supported_modes(const struct skge_hw *hw) |
176 | { | 177 | { |
@@ -531,13 +532,13 @@ static inline u32 hwkhz(const struct skge_hw *hw) | |||
531 | return 78215; /* or: 78.125 MHz */ | 532 | return 78215; /* or: 78.125 MHz */ |
532 | } | 533 | } |
533 | 534 | ||
534 | /* Chip hz to microseconds */ | 535 | /* Chip HZ to microseconds */ |
535 | static inline u32 skge_clk2usec(const struct skge_hw *hw, u32 ticks) | 536 | static inline u32 skge_clk2usec(const struct skge_hw *hw, u32 ticks) |
536 | { | 537 | { |
537 | return (ticks * 1000) / hwkhz(hw); | 538 | return (ticks * 1000) / hwkhz(hw); |
538 | } | 539 | } |
539 | 540 | ||
540 | /* Microseconds to chip hz */ | 541 | /* Microseconds to chip HZ */ |
541 | static inline u32 skge_usecs2clk(const struct skge_hw *hw, u32 usec) | 542 | static inline u32 skge_usecs2clk(const struct skge_hw *hw, u32 usec) |
542 | { | 543 | { |
543 | return hwkhz(hw) * usec / 1000; | 544 | return hwkhz(hw) * usec / 1000; |
@@ -883,32 +884,37 @@ static void skge_link_down(struct skge_port *skge) | |||
883 | printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name); | 884 | printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name); |
884 | } | 885 | } |
885 | 886 | ||
886 | static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg) | 887 | static int __xm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val) |
887 | { | 888 | { |
888 | int i; | 889 | int i; |
889 | u16 v; | ||
890 | 890 | ||
891 | xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); | 891 | xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); |
892 | v = xm_read16(hw, port, XM_PHY_DATA); | 892 | xm_read16(hw, port, XM_PHY_DATA); |
893 | 893 | ||
894 | /* Need to wait for external PHY */ | 894 | /* Need to wait for external PHY */ |
895 | for (i = 0; i < PHY_RETRIES; i++) { | 895 | for (i = 0; i < PHY_RETRIES; i++) { |
896 | udelay(1); | 896 | udelay(1); |
897 | if (xm_read16(hw, port, XM_MMU_CMD) | 897 | if (xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_RDY) |
898 | & XM_MMU_PHY_RDY) | ||
899 | goto ready; | 898 | goto ready; |
900 | } | 899 | } |
901 | 900 | ||
902 | printk(KERN_WARNING PFX "%s: phy read timed out\n", | 901 | return -ETIMEDOUT; |
903 | hw->dev[port]->name); | ||
904 | return 0; | ||
905 | ready: | 902 | ready: |
906 | v = xm_read16(hw, port, XM_PHY_DATA); | 903 | *val = xm_read16(hw, port, XM_PHY_DATA); |
907 | 904 | ||
905 | return 0; | ||
906 | } | ||
907 | |||
908 | static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg) | ||
909 | { | ||
910 | u16 v = 0; | ||
911 | if (__xm_phy_read(hw, port, reg, &v)) | ||
912 | printk(KERN_WARNING PFX "%s: phy read timed out\n", | ||
913 | hw->dev[port]->name); | ||
908 | return v; | 914 | return v; |
909 | } | 915 | } |
910 | 916 | ||
911 | static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | 917 | static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) |
912 | { | 918 | { |
913 | int i; | 919 | int i; |
914 | 920 | ||
@@ -918,19 +924,11 @@ static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | |||
918 | goto ready; | 924 | goto ready; |
919 | udelay(1); | 925 | udelay(1); |
920 | } | 926 | } |
921 | printk(KERN_WARNING PFX "%s: phy write failed to come ready\n", | 927 | return -EIO; |
922 | hw->dev[port]->name); | ||
923 | |||
924 | 928 | ||
925 | ready: | 929 | ready: |
926 | xm_write16(hw, port, XM_PHY_DATA, val); | 930 | xm_write16(hw, port, XM_PHY_DATA, val); |
927 | for (i = 0; i < PHY_RETRIES; i++) { | 931 | return 0; |
928 | udelay(1); | ||
929 | if (!(xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) | ||
930 | return; | ||
931 | } | ||
932 | printk(KERN_WARNING PFX "%s: phy write timed out\n", | ||
933 | hw->dev[port]->name); | ||
934 | } | 932 | } |
935 | 933 | ||
936 | static void genesis_init(struct skge_hw *hw) | 934 | static void genesis_init(struct skge_hw *hw) |
@@ -1165,7 +1163,7 @@ static void bcom_phy_init(struct skge_port *skge, int jumbo) | |||
1165 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ext); | 1163 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ext); |
1166 | xm_phy_write(hw, port, PHY_BCOM_CTRL, ctl); | 1164 | xm_phy_write(hw, port, PHY_BCOM_CTRL, ctl); |
1167 | 1165 | ||
1168 | /* Use link status change interrrupt */ | 1166 | /* Use link status change interrupt */ |
1169 | xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); | 1167 | xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); |
1170 | 1168 | ||
1171 | bcom_check_link(hw, port); | 1169 | bcom_check_link(hw, port); |
@@ -1205,7 +1203,7 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1205 | skge_write32(hw, B2_GP_IO, r); | 1203 | skge_write32(hw, B2_GP_IO, r); |
1206 | skge_read32(hw, B2_GP_IO); | 1204 | skge_read32(hw, B2_GP_IO); |
1207 | 1205 | ||
1208 | /* Enable GMII interfac */ | 1206 | /* Enable GMII interface */ |
1209 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); | 1207 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); |
1210 | 1208 | ||
1211 | bcom_phy_init(skge, jumbo); | 1209 | bcom_phy_init(skge, jumbo); |
@@ -1256,7 +1254,7 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1256 | * that jumbo frames larger than 8192 bytes will be | 1254 | * that jumbo frames larger than 8192 bytes will be |
1257 | * truncated. Disabling all bad frame filtering causes | 1255 | * truncated. Disabling all bad frame filtering causes |
1258 | * the RX FIFO to operate in streaming mode, in which | 1256 | * the RX FIFO to operate in streaming mode, in which |
1259 | * case the XMAC will start transfering frames out of the | 1257 | * case the XMAC will start transferring frames out of the |
1260 | * RX FIFO as soon as the FIFO threshold is reached. | 1258 | * RX FIFO as soon as the FIFO threshold is reached. |
1261 | */ | 1259 | */ |
1262 | xm_write32(hw, port, XM_MODE, XM_DEF_MODE); | 1260 | xm_write32(hw, port, XM_MODE, XM_DEF_MODE); |
@@ -1323,7 +1321,7 @@ static void genesis_stop(struct skge_port *skge) | |||
1323 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); | 1321 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); |
1324 | 1322 | ||
1325 | /* | 1323 | /* |
1326 | * If the transfer stucks at the MAC the STOP command will not | 1324 | * If the transfer sticks at the MAC the STOP command will not |
1327 | * terminate if we don't flush the XMAC's transmit FIFO ! | 1325 | * terminate if we don't flush the XMAC's transmit FIFO ! |
1328 | */ | 1326 | */ |
1329 | xm_write32(hw, port, XM_MODE, | 1327 | xm_write32(hw, port, XM_MODE, |
@@ -1400,42 +1398,6 @@ static void genesis_mac_intr(struct skge_hw *hw, int port) | |||
1400 | } | 1398 | } |
1401 | } | 1399 | } |
1402 | 1400 | ||
1403 | static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | ||
1404 | { | ||
1405 | int i; | ||
1406 | |||
1407 | gma_write16(hw, port, GM_SMI_DATA, val); | ||
1408 | gma_write16(hw, port, GM_SMI_CTRL, | ||
1409 | GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); | ||
1410 | for (i = 0; i < PHY_RETRIES; i++) { | ||
1411 | udelay(1); | ||
1412 | |||
1413 | if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) | ||
1414 | break; | ||
1415 | } | ||
1416 | } | ||
1417 | |||
1418 | static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg) | ||
1419 | { | ||
1420 | int i; | ||
1421 | |||
1422 | gma_write16(hw, port, GM_SMI_CTRL, | ||
1423 | GM_SMI_CT_PHY_AD(hw->phy_addr) | ||
1424 | | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); | ||
1425 | |||
1426 | for (i = 0; i < PHY_RETRIES; i++) { | ||
1427 | udelay(1); | ||
1428 | if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) | ||
1429 | goto ready; | ||
1430 | } | ||
1431 | |||
1432 | printk(KERN_WARNING PFX "%s: phy read timeout\n", | ||
1433 | hw->dev[port]->name); | ||
1434 | return 0; | ||
1435 | ready: | ||
1436 | return gma_read16(hw, port, GM_SMI_DATA); | ||
1437 | } | ||
1438 | |||
1439 | static void genesis_link_up(struct skge_port *skge) | 1401 | static void genesis_link_up(struct skge_port *skge) |
1440 | { | 1402 | { |
1441 | struct skge_hw *hw = skge->hw; | 1403 | struct skge_hw *hw = skge->hw; |
@@ -1549,7 +1511,55 @@ static inline void bcom_phy_intr(struct skge_port *skge) | |||
1549 | 1511 | ||
1550 | } | 1512 | } |
1551 | 1513 | ||
1552 | /* Marvell Phy Initailization */ | 1514 | static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) |
1515 | { | ||
1516 | int i; | ||
1517 | |||
1518 | gma_write16(hw, port, GM_SMI_DATA, val); | ||
1519 | gma_write16(hw, port, GM_SMI_CTRL, | ||
1520 | GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); | ||
1521 | for (i = 0; i < PHY_RETRIES; i++) { | ||
1522 | udelay(1); | ||
1523 | |||
1524 | if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) | ||
1525 | return 0; | ||
1526 | } | ||
1527 | |||
1528 | printk(KERN_WARNING PFX "%s: phy write timeout\n", | ||
1529 | hw->dev[port]->name); | ||
1530 | return -EIO; | ||
1531 | } | ||
1532 | |||
1533 | static int __gm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val) | ||
1534 | { | ||
1535 | int i; | ||
1536 | |||
1537 | gma_write16(hw, port, GM_SMI_CTRL, | ||
1538 | GM_SMI_CT_PHY_AD(hw->phy_addr) | ||
1539 | | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); | ||
1540 | |||
1541 | for (i = 0; i < PHY_RETRIES; i++) { | ||
1542 | udelay(1); | ||
1543 | if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) | ||
1544 | goto ready; | ||
1545 | } | ||
1546 | |||
1547 | return -ETIMEDOUT; | ||
1548 | ready: | ||
1549 | *val = gma_read16(hw, port, GM_SMI_DATA); | ||
1550 | return 0; | ||
1551 | } | ||
1552 | |||
1553 | static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg) | ||
1554 | { | ||
1555 | u16 v = 0; | ||
1556 | if (__gm_phy_read(hw, port, reg, &v)) | ||
1557 | printk(KERN_WARNING PFX "%s: phy read timeout\n", | ||
1558 | hw->dev[port]->name); | ||
1559 | return v; | ||
1560 | } | ||
1561 | |||
1562 | /* Marvell Phy Initialization */ | ||
1553 | static void yukon_init(struct skge_hw *hw, int port) | 1563 | static void yukon_init(struct skge_hw *hw, int port) |
1554 | { | 1564 | { |
1555 | struct skge_port *skge = netdev_priv(hw->dev[port]); | 1565 | struct skge_port *skge = netdev_priv(hw->dev[port]); |
@@ -1794,6 +1804,25 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1794 | skge_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); | 1804 | skge_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); |
1795 | } | 1805 | } |
1796 | 1806 | ||
1807 | /* Go into power down mode */ | ||
1808 | static void yukon_suspend(struct skge_hw *hw, int port) | ||
1809 | { | ||
1810 | u16 ctrl; | ||
1811 | |||
1812 | ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); | ||
1813 | ctrl |= PHY_M_PC_POL_R_DIS; | ||
1814 | gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl); | ||
1815 | |||
1816 | ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); | ||
1817 | ctrl |= PHY_CT_RESET; | ||
1818 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); | ||
1819 | |||
1820 | /* switch IEEE compatible power down mode on */ | ||
1821 | ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); | ||
1822 | ctrl |= PHY_CT_PDOWN; | ||
1823 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); | ||
1824 | } | ||
1825 | |||
1797 | static void yukon_stop(struct skge_port *skge) | 1826 | static void yukon_stop(struct skge_port *skge) |
1798 | { | 1827 | { |
1799 | struct skge_hw *hw = skge->hw; | 1828 | struct skge_hw *hw = skge->hw; |
@@ -1807,14 +1836,7 @@ static void yukon_stop(struct skge_port *skge) | |||
1807 | & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA)); | 1836 | & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA)); |
1808 | gma_read16(hw, port, GM_GP_CTRL); | 1837 | gma_read16(hw, port, GM_GP_CTRL); |
1809 | 1838 | ||
1810 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1839 | yukon_suspend(hw, port); |
1811 | hw->chip_rev >= CHIP_REV_YU_LITE_A3) { | ||
1812 | u32 io = skge_read32(hw, B2_GP_IO); | ||
1813 | |||
1814 | io |= GP_DIR_9 | GP_IO_9; | ||
1815 | skge_write32(hw, B2_GP_IO, io); | ||
1816 | skge_read32(hw, B2_GP_IO); | ||
1817 | } | ||
1818 | 1840 | ||
1819 | /* set GPHY Control reset */ | 1841 | /* set GPHY Control reset */ |
1820 | skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); | 1842 | skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); |
@@ -1997,6 +2019,51 @@ static void yukon_phy_intr(struct skge_port *skge) | |||
1997 | /* XXX restart autonegotiation? */ | 2019 | /* XXX restart autonegotiation? */ |
1998 | } | 2020 | } |
1999 | 2021 | ||
2022 | /* Basic MII support */ | ||
2023 | static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | ||
2024 | { | ||
2025 | struct mii_ioctl_data *data = if_mii(ifr); | ||
2026 | struct skge_port *skge = netdev_priv(dev); | ||
2027 | struct skge_hw *hw = skge->hw; | ||
2028 | int err = -EOPNOTSUPP; | ||
2029 | |||
2030 | if (!netif_running(dev)) | ||
2031 | return -ENODEV; /* Phy still in reset */ | ||
2032 | |||
2033 | switch(cmd) { | ||
2034 | case SIOCGMIIPHY: | ||
2035 | data->phy_id = hw->phy_addr; | ||
2036 | |||
2037 | /* fallthru */ | ||
2038 | case SIOCGMIIREG: { | ||
2039 | u16 val = 0; | ||
2040 | spin_lock_bh(&hw->phy_lock); | ||
2041 | if (hw->chip_id == CHIP_ID_GENESIS) | ||
2042 | err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); | ||
2043 | else | ||
2044 | err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); | ||
2045 | spin_unlock_bh(&hw->phy_lock); | ||
2046 | data->val_out = val; | ||
2047 | break; | ||
2048 | } | ||
2049 | |||
2050 | case SIOCSMIIREG: | ||
2051 | if (!capable(CAP_NET_ADMIN)) | ||
2052 | return -EPERM; | ||
2053 | |||
2054 | spin_lock_bh(&hw->phy_lock); | ||
2055 | if (hw->chip_id == CHIP_ID_GENESIS) | ||
2056 | err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f, | ||
2057 | data->val_in); | ||
2058 | else | ||
2059 | err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f, | ||
2060 | data->val_in); | ||
2061 | spin_unlock_bh(&hw->phy_lock); | ||
2062 | break; | ||
2063 | } | ||
2064 | return err; | ||
2065 | } | ||
2066 | |||
2000 | static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len) | 2067 | static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len) |
2001 | { | 2068 | { |
2002 | u32 end; | 2069 | u32 end; |
@@ -2089,7 +2156,7 @@ static int skge_up(struct net_device *dev) | |||
2089 | hw->intr_mask |= portirqmask[port]; | 2156 | hw->intr_mask |= portirqmask[port]; |
2090 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2157 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2091 | 2158 | ||
2092 | /* Initialze MAC */ | 2159 | /* Initialize MAC */ |
2093 | spin_lock_bh(&hw->phy_lock); | 2160 | spin_lock_bh(&hw->phy_lock); |
2094 | if (hw->chip_id == CHIP_ID_GENESIS) | 2161 | if (hw->chip_id == CHIP_ID_GENESIS) |
2095 | genesis_mac_init(hw, port); | 2162 | genesis_mac_init(hw, port); |
@@ -2409,7 +2476,7 @@ static void yukon_set_multicast(struct net_device *dev) | |||
2409 | reg = gma_read16(hw, port, GM_RX_CTRL); | 2476 | reg = gma_read16(hw, port, GM_RX_CTRL); |
2410 | reg |= GM_RXCR_UCF_ENA; | 2477 | reg |= GM_RXCR_UCF_ENA; |
2411 | 2478 | ||
2412 | if (dev->flags & IFF_PROMISC) /* promiscious */ | 2479 | if (dev->flags & IFF_PROMISC) /* promiscuous */ |
2413 | reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); | 2480 | reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); |
2414 | else if (dev->flags & IFF_ALLMULTI) /* all multicast */ | 2481 | else if (dev->flags & IFF_ALLMULTI) /* all multicast */ |
2415 | memset(filter, 0xff, sizeof(filter)); | 2482 | memset(filter, 0xff, sizeof(filter)); |
@@ -2560,7 +2627,7 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2560 | unsigned int to_do = min(dev->quota, *budget); | 2627 | unsigned int to_do = min(dev->quota, *budget); |
2561 | unsigned int work_done = 0; | 2628 | unsigned int work_done = 0; |
2562 | 2629 | ||
2563 | for (e = ring->to_clean; work_done < to_do; e = e->next) { | 2630 | for (e = ring->to_clean; prefetch(e->next), work_done < to_do; e = e->next) { |
2564 | struct skge_rx_desc *rd = e->desc; | 2631 | struct skge_rx_desc *rd = e->desc; |
2565 | struct sk_buff *skb; | 2632 | struct sk_buff *skb; |
2566 | u32 control; | 2633 | u32 control; |
@@ -2593,11 +2660,11 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2593 | if (work_done >= to_do) | 2660 | if (work_done >= to_do) |
2594 | return 1; /* not done */ | 2661 | return 1; /* not done */ |
2595 | 2662 | ||
2596 | local_irq_disable(); | 2663 | netif_rx_complete(dev); |
2597 | __netif_rx_complete(dev); | ||
2598 | hw->intr_mask |= portirqmask[skge->port]; | 2664 | hw->intr_mask |= portirqmask[skge->port]; |
2599 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2665 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2600 | local_irq_enable(); | 2666 | skge_read32(hw, B0_IMSK); |
2667 | |||
2601 | return 0; | 2668 | return 0; |
2602 | } | 2669 | } |
2603 | 2670 | ||
@@ -2609,7 +2676,7 @@ static inline void skge_tx_intr(struct net_device *dev) | |||
2609 | struct skge_element *e; | 2676 | struct skge_element *e; |
2610 | 2677 | ||
2611 | spin_lock(&skge->tx_lock); | 2678 | spin_lock(&skge->tx_lock); |
2612 | for (e = ring->to_clean; e != ring->to_use; e = e->next) { | 2679 | for (e = ring->to_clean; prefetch(e->next), e != ring->to_use; e = e->next) { |
2613 | struct skge_tx_desc *td = e->desc; | 2680 | struct skge_tx_desc *td = e->desc; |
2614 | u32 control; | 2681 | u32 control; |
2615 | 2682 | ||
@@ -2732,7 +2799,7 @@ static void skge_error_irq(struct skge_hw *hw) | |||
2732 | } | 2799 | } |
2733 | 2800 | ||
2734 | /* | 2801 | /* |
2735 | * Interrrupt from PHY are handled in tasklet (soft irq) | 2802 | * Interrupt from PHY are handled in tasklet (soft irq) |
2736 | * because accessing phy registers requires spin wait which might | 2803 | * because accessing phy registers requires spin wait which might |
2737 | * cause excess interrupt latency. | 2804 | * cause excess interrupt latency. |
2738 | */ | 2805 | */ |
@@ -2762,6 +2829,14 @@ static void skge_extirq(unsigned long data) | |||
2762 | local_irq_enable(); | 2829 | local_irq_enable(); |
2763 | } | 2830 | } |
2764 | 2831 | ||
2832 | static inline void skge_wakeup(struct net_device *dev) | ||
2833 | { | ||
2834 | struct skge_port *skge = netdev_priv(dev); | ||
2835 | |||
2836 | prefetch(skge->rx_ring.to_clean); | ||
2837 | netif_rx_schedule(dev); | ||
2838 | } | ||
2839 | |||
2765 | static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | 2840 | static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) |
2766 | { | 2841 | { |
2767 | struct skge_hw *hw = dev_id; | 2842 | struct skge_hw *hw = dev_id; |
@@ -2773,12 +2848,12 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2773 | status &= hw->intr_mask; | 2848 | status &= hw->intr_mask; |
2774 | if (status & IS_R1_F) { | 2849 | if (status & IS_R1_F) { |
2775 | hw->intr_mask &= ~IS_R1_F; | 2850 | hw->intr_mask &= ~IS_R1_F; |
2776 | netif_rx_schedule(hw->dev[0]); | 2851 | skge_wakeup(hw->dev[0]); |
2777 | } | 2852 | } |
2778 | 2853 | ||
2779 | if (status & IS_R2_F) { | 2854 | if (status & IS_R2_F) { |
2780 | hw->intr_mask &= ~IS_R2_F; | 2855 | hw->intr_mask &= ~IS_R2_F; |
2781 | netif_rx_schedule(hw->dev[1]); | 2856 | skge_wakeup(hw->dev[1]); |
2782 | } | 2857 | } |
2783 | 2858 | ||
2784 | if (status & IS_XA1_F) | 2859 | if (status & IS_XA1_F) |
@@ -2893,6 +2968,7 @@ static const char *skge_board_name(const struct skge_hw *hw) | |||
2893 | */ | 2968 | */ |
2894 | static int skge_reset(struct skge_hw *hw) | 2969 | static int skge_reset(struct skge_hw *hw) |
2895 | { | 2970 | { |
2971 | u32 reg; | ||
2896 | u16 ctst; | 2972 | u16 ctst; |
2897 | u8 t8, mac_cfg, pmd_type, phy_type; | 2973 | u8 t8, mac_cfg, pmd_type, phy_type; |
2898 | int i; | 2974 | int i; |
@@ -2971,6 +3047,7 @@ static int skge_reset(struct skge_hw *hw) | |||
2971 | /* switch power to VCC (WA for VAUX problem) */ | 3047 | /* switch power to VCC (WA for VAUX problem) */ |
2972 | skge_write8(hw, B0_POWER_CTRL, | 3048 | skge_write8(hw, B0_POWER_CTRL, |
2973 | PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); | 3049 | PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); |
3050 | |||
2974 | /* avoid boards with stuck Hardware error bits */ | 3051 | /* avoid boards with stuck Hardware error bits */ |
2975 | if ((skge_read32(hw, B0_ISRC) & IS_HW_ERR) && | 3052 | if ((skge_read32(hw, B0_ISRC) & IS_HW_ERR) && |
2976 | (skge_read32(hw, B0_HWE_ISRC) & IS_IRQ_SENSOR)) { | 3053 | (skge_read32(hw, B0_HWE_ISRC) & IS_IRQ_SENSOR)) { |
@@ -2978,6 +3055,14 @@ static int skge_reset(struct skge_hw *hw) | |||
2978 | hw->intr_mask &= ~IS_HW_ERR; | 3055 | hw->intr_mask &= ~IS_HW_ERR; |
2979 | } | 3056 | } |
2980 | 3057 | ||
3058 | /* Clear PHY COMA */ | ||
3059 | skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
3060 | pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®); | ||
3061 | reg &= ~PCI_PHY_COMA; | ||
3062 | pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg); | ||
3063 | skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
3064 | |||
3065 | |||
2981 | for (i = 0; i < hw->ports; i++) { | 3066 | for (i = 0; i < hw->ports; i++) { |
2982 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); | 3067 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); |
2983 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); | 3068 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); |
@@ -3048,6 +3133,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3048 | SET_NETDEV_DEV(dev, &hw->pdev->dev); | 3133 | SET_NETDEV_DEV(dev, &hw->pdev->dev); |
3049 | dev->open = skge_up; | 3134 | dev->open = skge_up; |
3050 | dev->stop = skge_down; | 3135 | dev->stop = skge_down; |
3136 | dev->do_ioctl = skge_ioctl; | ||
3051 | dev->hard_start_xmit = skge_xmit_frame; | 3137 | dev->hard_start_xmit = skge_xmit_frame; |
3052 | dev->get_stats = skge_get_stats; | 3138 | dev->get_stats = skge_get_stats; |
3053 | if (hw->chip_id == CHIP_ID_GENESIS) | 3139 | if (hw->chip_id == CHIP_ID_GENESIS) |
@@ -3147,7 +3233,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3147 | } | 3233 | } |
3148 | 3234 | ||
3149 | #ifdef __BIG_ENDIAN | 3235 | #ifdef __BIG_ENDIAN |
3150 | /* byte swap decriptors in hardware */ | 3236 | /* byte swap descriptors in hardware */ |
3151 | { | 3237 | { |
3152 | u32 reg; | 3238 | u32 reg; |
3153 | 3239 | ||
@@ -3158,14 +3244,13 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3158 | #endif | 3244 | #endif |
3159 | 3245 | ||
3160 | err = -ENOMEM; | 3246 | err = -ENOMEM; |
3161 | hw = kmalloc(sizeof(*hw), GFP_KERNEL); | 3247 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); |
3162 | if (!hw) { | 3248 | if (!hw) { |
3163 | printk(KERN_ERR PFX "%s: cannot allocate hardware struct\n", | 3249 | printk(KERN_ERR PFX "%s: cannot allocate hardware struct\n", |
3164 | pci_name(pdev)); | 3250 | pci_name(pdev)); |
3165 | goto err_out_free_regions; | 3251 | goto err_out_free_regions; |
3166 | } | 3252 | } |
3167 | 3253 | ||
3168 | memset(hw, 0, sizeof(*hw)); | ||
3169 | hw->pdev = pdev; | 3254 | hw->pdev = pdev; |
3170 | spin_lock_init(&hw->phy_lock); | 3255 | spin_lock_init(&hw->phy_lock); |
3171 | tasklet_init(&hw->ext_tasklet, skge_extirq, (unsigned long) hw); | 3256 | tasklet_init(&hw->ext_tasklet, skge_extirq, (unsigned long) hw); |
@@ -3188,7 +3273,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3188 | if (err) | 3273 | if (err) |
3189 | goto err_out_free_irq; | 3274 | goto err_out_free_irq; |
3190 | 3275 | ||
3191 | printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n", | 3276 | printk(KERN_INFO PFX DRV_VERSION " addr 0x%lx irq %d chip %s rev %d\n", |
3192 | pci_resource_start(pdev, 0), pdev->irq, | 3277 | pci_resource_start(pdev, 0), pdev->irq, |
3193 | skge_board_name(hw), hw->chip_rev); | 3278 | skge_board_name(hw), hw->chip_rev); |
3194 | 3279 | ||
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index 72c175b87a5a..ee123c15f545 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | /* PCI config registers */ | 7 | /* PCI config registers */ |
8 | #define PCI_DEV_REG1 0x40 | 8 | #define PCI_DEV_REG1 0x40 |
9 | #define PCI_PHY_COMA 0x8000000 | ||
10 | #define PCI_VIO 0x2000000 | ||
9 | #define PCI_DEV_REG2 0x44 | 11 | #define PCI_DEV_REG2 0x44 |
10 | #define PCI_REV_DESC 0x4 | 12 | #define PCI_REV_DESC 0x4 |
11 | 13 | ||
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 6afc6e5dee9b..340ab4ee4b67 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -4535,9 +4535,8 @@ static int proc_status_open( struct inode *inode, struct file *file ) { | |||
4535 | StatusRid status_rid; | 4535 | StatusRid status_rid; |
4536 | int i; | 4536 | int i; |
4537 | 4537 | ||
4538 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4538 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4539 | return -ENOMEM; | 4539 | return -ENOMEM; |
4540 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4541 | data = (struct proc_data *)file->private_data; | 4540 | data = (struct proc_data *)file->private_data; |
4542 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4541 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { |
4543 | kfree (file->private_data); | 4542 | kfree (file->private_data); |
@@ -4615,9 +4614,8 @@ static int proc_stats_rid_open( struct inode *inode, | |||
4615 | int i, j; | 4614 | int i, j; |
4616 | u32 *vals = stats.vals; | 4615 | u32 *vals = stats.vals; |
4617 | 4616 | ||
4618 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4617 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4619 | return -ENOMEM; | 4618 | return -ENOMEM; |
4620 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4621 | data = (struct proc_data *)file->private_data; | 4619 | data = (struct proc_data *)file->private_data; |
4622 | if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { | 4620 | if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { |
4623 | kfree (file->private_data); | 4621 | kfree (file->private_data); |
@@ -4881,20 +4879,18 @@ static int proc_config_open( struct inode *inode, struct file *file ) { | |||
4881 | struct airo_info *ai = dev->priv; | 4879 | struct airo_info *ai = dev->priv; |
4882 | int i; | 4880 | int i; |
4883 | 4881 | ||
4884 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4882 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4885 | return -ENOMEM; | 4883 | return -ENOMEM; |
4886 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4887 | data = (struct proc_data *)file->private_data; | 4884 | data = (struct proc_data *)file->private_data; |
4888 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4885 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { |
4889 | kfree (file->private_data); | 4886 | kfree (file->private_data); |
4890 | return -ENOMEM; | 4887 | return -ENOMEM; |
4891 | } | 4888 | } |
4892 | if ((data->wbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4889 | if ((data->wbuffer = kzalloc( 2048, GFP_KERNEL )) == NULL) { |
4893 | kfree (data->rbuffer); | 4890 | kfree (data->rbuffer); |
4894 | kfree (file->private_data); | 4891 | kfree (file->private_data); |
4895 | return -ENOMEM; | 4892 | return -ENOMEM; |
4896 | } | 4893 | } |
4897 | memset( data->wbuffer, 0, 2048 ); | ||
4898 | data->maxwritelen = 2048; | 4894 | data->maxwritelen = 2048; |
4899 | data->on_close = proc_config_on_close; | 4895 | data->on_close = proc_config_on_close; |
4900 | 4896 | ||
@@ -5155,24 +5151,21 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) { | |||
5155 | int j=0; | 5151 | int j=0; |
5156 | int rc; | 5152 | int rc; |
5157 | 5153 | ||
5158 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5154 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5159 | return -ENOMEM; | 5155 | return -ENOMEM; |
5160 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5161 | memset(&wkr, 0, sizeof(wkr)); | 5156 | memset(&wkr, 0, sizeof(wkr)); |
5162 | data = (struct proc_data *)file->private_data; | 5157 | data = (struct proc_data *)file->private_data; |
5163 | if ((data->rbuffer = kmalloc( 180, GFP_KERNEL )) == NULL) { | 5158 | if ((data->rbuffer = kzalloc( 180, GFP_KERNEL )) == NULL) { |
5164 | kfree (file->private_data); | 5159 | kfree (file->private_data); |
5165 | return -ENOMEM; | 5160 | return -ENOMEM; |
5166 | } | 5161 | } |
5167 | memset(data->rbuffer, 0, 180); | ||
5168 | data->writelen = 0; | 5162 | data->writelen = 0; |
5169 | data->maxwritelen = 80; | 5163 | data->maxwritelen = 80; |
5170 | if ((data->wbuffer = kmalloc( 80, GFP_KERNEL )) == NULL) { | 5164 | if ((data->wbuffer = kzalloc( 80, GFP_KERNEL )) == NULL) { |
5171 | kfree (data->rbuffer); | 5165 | kfree (data->rbuffer); |
5172 | kfree (file->private_data); | 5166 | kfree (file->private_data); |
5173 | return -ENOMEM; | 5167 | return -ENOMEM; |
5174 | } | 5168 | } |
5175 | memset( data->wbuffer, 0, 80 ); | ||
5176 | data->on_close = proc_wepkey_on_close; | 5169 | data->on_close = proc_wepkey_on_close; |
5177 | 5170 | ||
5178 | ptr = data->rbuffer; | 5171 | ptr = data->rbuffer; |
@@ -5203,9 +5196,8 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { | |||
5203 | char *ptr; | 5196 | char *ptr; |
5204 | SsidRid SSID_rid; | 5197 | SsidRid SSID_rid; |
5205 | 5198 | ||
5206 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5199 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5207 | return -ENOMEM; | 5200 | return -ENOMEM; |
5208 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5209 | data = (struct proc_data *)file->private_data; | 5201 | data = (struct proc_data *)file->private_data; |
5210 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { | 5202 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { |
5211 | kfree (file->private_data); | 5203 | kfree (file->private_data); |
@@ -5213,12 +5205,11 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { | |||
5213 | } | 5205 | } |
5214 | data->writelen = 0; | 5206 | data->writelen = 0; |
5215 | data->maxwritelen = 33*3; | 5207 | data->maxwritelen = 33*3; |
5216 | if ((data->wbuffer = kmalloc( 33*3, GFP_KERNEL )) == NULL) { | 5208 | if ((data->wbuffer = kzalloc( 33*3, GFP_KERNEL )) == NULL) { |
5217 | kfree (data->rbuffer); | 5209 | kfree (data->rbuffer); |
5218 | kfree (file->private_data); | 5210 | kfree (file->private_data); |
5219 | return -ENOMEM; | 5211 | return -ENOMEM; |
5220 | } | 5212 | } |
5221 | memset( data->wbuffer, 0, 33*3 ); | ||
5222 | data->on_close = proc_SSID_on_close; | 5213 | data->on_close = proc_SSID_on_close; |
5223 | 5214 | ||
5224 | readSsidRid(ai, &SSID_rid); | 5215 | readSsidRid(ai, &SSID_rid); |
@@ -5247,9 +5238,8 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { | |||
5247 | char *ptr; | 5238 | char *ptr; |
5248 | APListRid APList_rid; | 5239 | APListRid APList_rid; |
5249 | 5240 | ||
5250 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5241 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5251 | return -ENOMEM; | 5242 | return -ENOMEM; |
5252 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5253 | data = (struct proc_data *)file->private_data; | 5243 | data = (struct proc_data *)file->private_data; |
5254 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { | 5244 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { |
5255 | kfree (file->private_data); | 5245 | kfree (file->private_data); |
@@ -5257,12 +5247,11 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { | |||
5257 | } | 5247 | } |
5258 | data->writelen = 0; | 5248 | data->writelen = 0; |
5259 | data->maxwritelen = 4*6*3; | 5249 | data->maxwritelen = 4*6*3; |
5260 | if ((data->wbuffer = kmalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { | 5250 | if ((data->wbuffer = kzalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { |
5261 | kfree (data->rbuffer); | 5251 | kfree (data->rbuffer); |
5262 | kfree (file->private_data); | 5252 | kfree (file->private_data); |
5263 | return -ENOMEM; | 5253 | return -ENOMEM; |
5264 | } | 5254 | } |
5265 | memset( data->wbuffer, 0, data->maxwritelen ); | ||
5266 | data->on_close = proc_APList_on_close; | 5255 | data->on_close = proc_APList_on_close; |
5267 | 5256 | ||
5268 | readAPListRid(ai, &APList_rid); | 5257 | readAPListRid(ai, &APList_rid); |
@@ -5297,9 +5286,8 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { | |||
5297 | /* If doLoseSync is not 1, we won't do a Lose Sync */ | 5286 | /* If doLoseSync is not 1, we won't do a Lose Sync */ |
5298 | int doLoseSync = -1; | 5287 | int doLoseSync = -1; |
5299 | 5288 | ||
5300 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5289 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5301 | return -ENOMEM; | 5290 | return -ENOMEM; |
5302 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5303 | data = (struct proc_data *)file->private_data; | 5291 | data = (struct proc_data *)file->private_data; |
5304 | if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { | 5292 | if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { |
5305 | kfree (file->private_data); | 5293 | kfree (file->private_data); |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 96ed8da8661d..e328547599dc 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -170,12 +170,11 @@ static dev_link_t *airo_attach(void) | |||
170 | DEBUG(0, "airo_attach()\n"); | 170 | DEBUG(0, "airo_attach()\n"); |
171 | 171 | ||
172 | /* Initialize the dev_link_t structure */ | 172 | /* Initialize the dev_link_t structure */ |
173 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 173 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
174 | if (!link) { | 174 | if (!link) { |
175 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 175 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
176 | return NULL; | 176 | return NULL; |
177 | } | 177 | } |
178 | memset(link, 0, sizeof(struct dev_link_t)); | ||
179 | 178 | ||
180 | /* Interrupt setup */ | 179 | /* Interrupt setup */ |
181 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 180 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -194,13 +193,12 @@ static dev_link_t *airo_attach(void) | |||
194 | link->conf.IntType = INT_MEMORY_AND_IO; | 193 | link->conf.IntType = INT_MEMORY_AND_IO; |
195 | 194 | ||
196 | /* Allocate space for private device-specific data */ | 195 | /* Allocate space for private device-specific data */ |
197 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 196 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
198 | if (!local) { | 197 | if (!local) { |
199 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 198 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
200 | kfree (link); | 199 | kfree (link); |
201 | return NULL; | 200 | return NULL; |
202 | } | 201 | } |
203 | memset(local, 0, sizeof(local_info_t)); | ||
204 | link->priv = local; | 202 | link->priv = local; |
205 | 203 | ||
206 | /* Register with Card Services */ | 204 | /* Register with Card Services */ |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 1fbe027d26b6..a3e23527fe7f 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -2217,7 +2217,7 @@ static int atmel_get_range(struct net_device *dev, | |||
2217 | int k,i,j; | 2217 | int k,i,j; |
2218 | 2218 | ||
2219 | dwrq->length = sizeof(struct iw_range); | 2219 | dwrq->length = sizeof(struct iw_range); |
2220 | memset(range, 0, sizeof(range)); | 2220 | memset(range, 0, sizeof(struct iw_range)); |
2221 | range->min_nwid = 0x0000; | 2221 | range->min_nwid = 0x0000; |
2222 | range->max_nwid = 0x0000; | 2222 | range->max_nwid = 0x0000; |
2223 | range->num_channels = 0; | 2223 | range->num_channels = 0; |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 195cb36619e8..1bd13146c644 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -180,12 +180,11 @@ static dev_link_t *atmel_attach(void) | |||
180 | DEBUG(0, "atmel_attach()\n"); | 180 | DEBUG(0, "atmel_attach()\n"); |
181 | 181 | ||
182 | /* Initialize the dev_link_t structure */ | 182 | /* Initialize the dev_link_t structure */ |
183 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 183 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
184 | if (!link) { | 184 | if (!link) { |
185 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 185 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
186 | return NULL; | 186 | return NULL; |
187 | } | 187 | } |
188 | memset(link, 0, sizeof(struct dev_link_t)); | ||
189 | 188 | ||
190 | /* Interrupt setup */ | 189 | /* Interrupt setup */ |
191 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 190 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -204,13 +203,12 @@ static dev_link_t *atmel_attach(void) | |||
204 | link->conf.IntType = INT_MEMORY_AND_IO; | 203 | link->conf.IntType = INT_MEMORY_AND_IO; |
205 | 204 | ||
206 | /* Allocate space for private device-specific data */ | 205 | /* Allocate space for private device-specific data */ |
207 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 206 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
208 | if (!local) { | 207 | if (!local) { |
209 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 208 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
210 | kfree (link); | 209 | kfree (link); |
211 | return NULL; | 210 | return NULL; |
212 | } | 211 | } |
213 | memset(local, 0, sizeof(local_info_t)); | ||
214 | link->priv = local; | 212 | link->priv = local; |
215 | 213 | ||
216 | /* Register with Card Services */ | 214 | /* Register with Card Services */ |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index ad7f8cd76db9..a2e6214169e9 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -167,17 +167,16 @@ that only one external action is invoked at a time. | |||
167 | 167 | ||
168 | #include "ipw2100.h" | 168 | #include "ipw2100.h" |
169 | 169 | ||
170 | #define IPW2100_VERSION "1.1.0" | 170 | #define IPW2100_VERSION "1.1.3" |
171 | 171 | ||
172 | #define DRV_NAME "ipw2100" | 172 | #define DRV_NAME "ipw2100" |
173 | #define DRV_VERSION IPW2100_VERSION | 173 | #define DRV_VERSION IPW2100_VERSION |
174 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" | 174 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" |
175 | #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" | 175 | #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" |
176 | |||
177 | 176 | ||
178 | /* Debugging stuff */ | 177 | /* Debugging stuff */ |
179 | #ifdef CONFIG_IPW_DEBUG | 178 | #ifdef CONFIG_IPW_DEBUG |
180 | #define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ | 179 | #define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ |
181 | #endif | 180 | #endif |
182 | 181 | ||
183 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | 182 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
@@ -220,18 +219,18 @@ do { \ | |||
220 | } while (0) | 219 | } while (0) |
221 | #else | 220 | #else |
222 | #define IPW_DEBUG(level, message...) do {} while (0) | 221 | #define IPW_DEBUG(level, message...) do {} while (0) |
223 | #endif /* CONFIG_IPW_DEBUG */ | 222 | #endif /* CONFIG_IPW_DEBUG */ |
224 | 223 | ||
225 | #ifdef CONFIG_IPW_DEBUG | 224 | #ifdef CONFIG_IPW_DEBUG |
226 | static const char *command_types[] = { | 225 | static const char *command_types[] = { |
227 | "undefined", | 226 | "undefined", |
228 | "unused", /* HOST_ATTENTION */ | 227 | "unused", /* HOST_ATTENTION */ |
229 | "HOST_COMPLETE", | 228 | "HOST_COMPLETE", |
230 | "unused", /* SLEEP */ | 229 | "unused", /* SLEEP */ |
231 | "unused", /* HOST_POWER_DOWN */ | 230 | "unused", /* HOST_POWER_DOWN */ |
232 | "unused", | 231 | "unused", |
233 | "SYSTEM_CONFIG", | 232 | "SYSTEM_CONFIG", |
234 | "unused", /* SET_IMR */ | 233 | "unused", /* SET_IMR */ |
235 | "SSID", | 234 | "SSID", |
236 | "MANDATORY_BSSID", | 235 | "MANDATORY_BSSID", |
237 | "AUTHENTICATION_TYPE", | 236 | "AUTHENTICATION_TYPE", |
@@ -277,17 +276,16 @@ static const char *command_types[] = { | |||
277 | "GROUP_ORDINALS", | 276 | "GROUP_ORDINALS", |
278 | "SHORT_RETRY_LIMIT", | 277 | "SHORT_RETRY_LIMIT", |
279 | "LONG_RETRY_LIMIT", | 278 | "LONG_RETRY_LIMIT", |
280 | "unused", /* SAVE_CALIBRATION */ | 279 | "unused", /* SAVE_CALIBRATION */ |
281 | "unused", /* RESTORE_CALIBRATION */ | 280 | "unused", /* RESTORE_CALIBRATION */ |
282 | "undefined", | 281 | "undefined", |
283 | "undefined", | 282 | "undefined", |
284 | "undefined", | 283 | "undefined", |
285 | "HOST_PRE_POWER_DOWN", | 284 | "HOST_PRE_POWER_DOWN", |
286 | "unused", /* HOST_INTERRUPT_COALESCING */ | 285 | "unused", /* HOST_INTERRUPT_COALESCING */ |
287 | "undefined", | 286 | "undefined", |
288 | "CARD_DISABLE_PHY_OFF", | 287 | "CARD_DISABLE_PHY_OFF", |
289 | "MSDU_TX_RATES" | 288 | "MSDU_TX_RATES" "undefined", |
290 | "undefined", | ||
291 | "undefined", | 289 | "undefined", |
292 | "SET_STATION_STAT_BITS", | 290 | "SET_STATION_STAT_BITS", |
293 | "CLEAR_STATIONS_STAT_BITS", | 291 | "CLEAR_STATIONS_STAT_BITS", |
@@ -298,7 +296,6 @@ static const char *command_types[] = { | |||
298 | }; | 296 | }; |
299 | #endif | 297 | #endif |
300 | 298 | ||
301 | |||
302 | /* Pre-decl until we get the code solid and then we can clean it up */ | 299 | /* Pre-decl until we get the code solid and then we can clean it up */ |
303 | static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); | 300 | static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); |
304 | static void ipw2100_tx_send_data(struct ipw2100_priv *priv); | 301 | static void ipw2100_tx_send_data(struct ipw2100_priv *priv); |
@@ -321,11 +318,10 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv, | |||
321 | static int ipw2100_ucode_download(struct ipw2100_priv *priv, | 318 | static int ipw2100_ucode_download(struct ipw2100_priv *priv, |
322 | struct ipw2100_fw *fw); | 319 | struct ipw2100_fw *fw); |
323 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv); | 320 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv); |
324 | static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev); | 321 | static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev); |
325 | static struct iw_handler_def ipw2100_wx_handler_def; | 322 | static struct iw_handler_def ipw2100_wx_handler_def; |
326 | 323 | ||
327 | 324 | static inline void read_register(struct net_device *dev, u32 reg, u32 * val) | |
328 | static inline void read_register(struct net_device *dev, u32 reg, u32 *val) | ||
329 | { | 325 | { |
330 | *val = readl((void __iomem *)(dev->base_addr + reg)); | 326 | *val = readl((void __iomem *)(dev->base_addr + reg)); |
331 | IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); | 327 | IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); |
@@ -337,13 +333,14 @@ static inline void write_register(struct net_device *dev, u32 reg, u32 val) | |||
337 | IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); | 333 | IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); |
338 | } | 334 | } |
339 | 335 | ||
340 | static inline void read_register_word(struct net_device *dev, u32 reg, u16 *val) | 336 | static inline void read_register_word(struct net_device *dev, u32 reg, |
337 | u16 * val) | ||
341 | { | 338 | { |
342 | *val = readw((void __iomem *)(dev->base_addr + reg)); | 339 | *val = readw((void __iomem *)(dev->base_addr + reg)); |
343 | IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); | 340 | IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); |
344 | } | 341 | } |
345 | 342 | ||
346 | static inline void read_register_byte(struct net_device *dev, u32 reg, u8 *val) | 343 | static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val) |
347 | { | 344 | { |
348 | *val = readb((void __iomem *)(dev->base_addr + reg)); | 345 | *val = readb((void __iomem *)(dev->base_addr + reg)); |
349 | IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); | 346 | IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); |
@@ -355,14 +352,13 @@ static inline void write_register_word(struct net_device *dev, u32 reg, u16 val) | |||
355 | IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); | 352 | IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); |
356 | } | 353 | } |
357 | 354 | ||
358 | |||
359 | static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) | 355 | static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) |
360 | { | 356 | { |
361 | writeb(val, (void __iomem *)(dev->base_addr + reg)); | 357 | writeb(val, (void __iomem *)(dev->base_addr + reg)); |
362 | IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); | 358 | IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); |
363 | } | 359 | } |
364 | 360 | ||
365 | static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 *val) | 361 | static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 * val) |
366 | { | 362 | { |
367 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 363 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
368 | addr & IPW_REG_INDIRECT_ADDR_MASK); | 364 | addr & IPW_REG_INDIRECT_ADDR_MASK); |
@@ -376,7 +372,7 @@ static inline void write_nic_dword(struct net_device *dev, u32 addr, u32 val) | |||
376 | write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); | 372 | write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); |
377 | } | 373 | } |
378 | 374 | ||
379 | static inline void read_nic_word(struct net_device *dev, u32 addr, u16 *val) | 375 | static inline void read_nic_word(struct net_device *dev, u32 addr, u16 * val) |
380 | { | 376 | { |
381 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 377 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
382 | addr & IPW_REG_INDIRECT_ADDR_MASK); | 378 | addr & IPW_REG_INDIRECT_ADDR_MASK); |
@@ -390,7 +386,7 @@ static inline void write_nic_word(struct net_device *dev, u32 addr, u16 val) | |||
390 | write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); | 386 | write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); |
391 | } | 387 | } |
392 | 388 | ||
393 | static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 *val) | 389 | static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 * val) |
394 | { | 390 | { |
395 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 391 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
396 | addr & IPW_REG_INDIRECT_ADDR_MASK); | 392 | addr & IPW_REG_INDIRECT_ADDR_MASK); |
@@ -416,7 +412,7 @@ static inline void write_nic_dword_auto_inc(struct net_device *dev, u32 val) | |||
416 | } | 412 | } |
417 | 413 | ||
418 | static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, | 414 | static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, |
419 | const u8 *buf) | 415 | const u8 * buf) |
420 | { | 416 | { |
421 | u32 aligned_addr; | 417 | u32 aligned_addr; |
422 | u32 aligned_len; | 418 | u32 aligned_len; |
@@ -431,32 +427,30 @@ static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, | |||
431 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 427 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
432 | aligned_addr); | 428 | aligned_addr); |
433 | for (i = dif_len; i < 4; i++, buf++) | 429 | for (i = dif_len; i < 4; i++, buf++) |
434 | write_register_byte( | 430 | write_register_byte(dev, |
435 | dev, IPW_REG_INDIRECT_ACCESS_DATA + i, | 431 | IPW_REG_INDIRECT_ACCESS_DATA + i, |
436 | *buf); | 432 | *buf); |
437 | 433 | ||
438 | len -= dif_len; | 434 | len -= dif_len; |
439 | aligned_addr += 4; | 435 | aligned_addr += 4; |
440 | } | 436 | } |
441 | 437 | ||
442 | /* read DWs through autoincrement registers */ | 438 | /* read DWs through autoincrement registers */ |
443 | write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, | 439 | write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); |
444 | aligned_addr); | ||
445 | aligned_len = len & (~0x3); | 440 | aligned_len = len & (~0x3); |
446 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | 441 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) |
447 | write_register( | 442 | write_register(dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *) buf); |
448 | dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *)buf); | ||
449 | 443 | ||
450 | /* copy the last nibble */ | 444 | /* copy the last nibble */ |
451 | dif_len = len - aligned_len; | 445 | dif_len = len - aligned_len; |
452 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); | 446 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); |
453 | for (i = 0; i < dif_len; i++, buf++) | 447 | for (i = 0; i < dif_len; i++, buf++) |
454 | write_register_byte( | 448 | write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, |
455 | dev, IPW_REG_INDIRECT_ACCESS_DATA + i, *buf); | 449 | *buf); |
456 | } | 450 | } |
457 | 451 | ||
458 | static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, | 452 | static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, |
459 | u8 *buf) | 453 | u8 * buf) |
460 | { | 454 | { |
461 | u32 aligned_addr; | 455 | u32 aligned_addr; |
462 | u32 aligned_len; | 456 | u32 aligned_len; |
@@ -471,39 +465,38 @@ static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, | |||
471 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 465 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
472 | aligned_addr); | 466 | aligned_addr); |
473 | for (i = dif_len; i < 4; i++, buf++) | 467 | for (i = dif_len; i < 4; i++, buf++) |
474 | read_register_byte( | 468 | read_register_byte(dev, |
475 | dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); | 469 | IPW_REG_INDIRECT_ACCESS_DATA + i, |
470 | buf); | ||
476 | 471 | ||
477 | len -= dif_len; | 472 | len -= dif_len; |
478 | aligned_addr += 4; | 473 | aligned_addr += 4; |
479 | } | 474 | } |
480 | 475 | ||
481 | /* read DWs through autoincrement registers */ | 476 | /* read DWs through autoincrement registers */ |
482 | write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, | 477 | write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); |
483 | aligned_addr); | ||
484 | aligned_len = len & (~0x3); | 478 | aligned_len = len & (~0x3); |
485 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | 479 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) |
486 | read_register(dev, IPW_REG_AUTOINCREMENT_DATA, | 480 | read_register(dev, IPW_REG_AUTOINCREMENT_DATA, (u32 *) buf); |
487 | (u32 *)buf); | ||
488 | 481 | ||
489 | /* copy the last nibble */ | 482 | /* copy the last nibble */ |
490 | dif_len = len - aligned_len; | 483 | dif_len = len - aligned_len; |
491 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 484 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); |
492 | aligned_addr); | ||
493 | for (i = 0; i < dif_len; i++, buf++) | 485 | for (i = 0; i < dif_len; i++, buf++) |
494 | read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + | 486 | read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); |
495 | i, buf); | ||
496 | } | 487 | } |
497 | 488 | ||
498 | static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev) | 489 | static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev) |
499 | { | 490 | { |
500 | return (dev->base_addr && | 491 | return (dev->base_addr && |
501 | (readl((void __iomem *)(dev->base_addr + IPW_REG_DOA_DEBUG_AREA_START)) | 492 | (readl |
493 | ((void __iomem *)(dev->base_addr + | ||
494 | IPW_REG_DOA_DEBUG_AREA_START)) | ||
502 | == IPW_DATA_DOA_DEBUG_VALUE)); | 495 | == IPW_DATA_DOA_DEBUG_VALUE)); |
503 | } | 496 | } |
504 | 497 | ||
505 | static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | 498 | static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, |
506 | void *val, u32 *len) | 499 | void *val, u32 * len) |
507 | { | 500 | { |
508 | struct ipw2100_ordinals *ordinals = &priv->ordinals; | 501 | struct ipw2100_ordinals *ordinals = &priv->ordinals; |
509 | u32 addr; | 502 | u32 addr; |
@@ -529,8 +522,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | |||
529 | return -EINVAL; | 522 | return -EINVAL; |
530 | } | 523 | } |
531 | 524 | ||
532 | read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2), | 525 | read_nic_dword(priv->net_dev, |
533 | &addr); | 526 | ordinals->table1_addr + (ord << 2), &addr); |
534 | read_nic_dword(priv->net_dev, addr, val); | 527 | read_nic_dword(priv->net_dev, addr, val); |
535 | 528 | ||
536 | *len = IPW_ORD_TAB_1_ENTRY_SIZE; | 529 | *len = IPW_ORD_TAB_1_ENTRY_SIZE; |
@@ -543,8 +536,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | |||
543 | ord -= IPW_START_ORD_TAB_2; | 536 | ord -= IPW_START_ORD_TAB_2; |
544 | 537 | ||
545 | /* get the address of statistic */ | 538 | /* get the address of statistic */ |
546 | read_nic_dword(priv->net_dev, ordinals->table2_addr + (ord << 3), | 539 | read_nic_dword(priv->net_dev, |
547 | &addr); | 540 | ordinals->table2_addr + (ord << 3), &addr); |
548 | 541 | ||
549 | /* get the second DW of statistics ; | 542 | /* get the second DW of statistics ; |
550 | * two 16-bit words - first is length, second is count */ | 543 | * two 16-bit words - first is length, second is count */ |
@@ -553,10 +546,10 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | |||
553 | &field_info); | 546 | &field_info); |
554 | 547 | ||
555 | /* get each entry length */ | 548 | /* get each entry length */ |
556 | field_len = *((u16 *)&field_info); | 549 | field_len = *((u16 *) & field_info); |
557 | 550 | ||
558 | /* get number of entries */ | 551 | /* get number of entries */ |
559 | field_count = *(((u16 *)&field_info) + 1); | 552 | field_count = *(((u16 *) & field_info) + 1); |
560 | 553 | ||
561 | /* abort if no enought memory */ | 554 | /* abort if no enought memory */ |
562 | total_length = field_len * field_count; | 555 | total_length = field_len * field_count; |
@@ -581,8 +574,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | |||
581 | return -EINVAL; | 574 | return -EINVAL; |
582 | } | 575 | } |
583 | 576 | ||
584 | static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, | 577 | static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 * val, |
585 | u32 *len) | 578 | u32 * len) |
586 | { | 579 | { |
587 | struct ipw2100_ordinals *ordinals = &priv->ordinals; | 580 | struct ipw2100_ordinals *ordinals = &priv->ordinals; |
588 | u32 addr; | 581 | u32 addr; |
@@ -594,8 +587,8 @@ static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, | |||
594 | return -EINVAL; | 587 | return -EINVAL; |
595 | } | 588 | } |
596 | 589 | ||
597 | read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2), | 590 | read_nic_dword(priv->net_dev, |
598 | &addr); | 591 | ordinals->table1_addr + (ord << 2), &addr); |
599 | 592 | ||
600 | write_nic_dword(priv->net_dev, addr, *val); | 593 | write_nic_dword(priv->net_dev, addr, *val); |
601 | 594 | ||
@@ -612,7 +605,7 @@ static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, | |||
612 | } | 605 | } |
613 | 606 | ||
614 | static char *snprint_line(char *buf, size_t count, | 607 | static char *snprint_line(char *buf, size_t count, |
615 | const u8 *data, u32 len, u32 ofs) | 608 | const u8 * data, u32 len, u32 ofs) |
616 | { | 609 | { |
617 | int out, i, j, l; | 610 | int out, i, j, l; |
618 | char c; | 611 | char c; |
@@ -646,7 +639,7 @@ static char *snprint_line(char *buf, size_t count, | |||
646 | return buf; | 639 | return buf; |
647 | } | 640 | } |
648 | 641 | ||
649 | static void printk_buf(int level, const u8 *data, u32 len) | 642 | static void printk_buf(int level, const u8 * data, u32 len) |
650 | { | 643 | { |
651 | char line[81]; | 644 | char line[81]; |
652 | u32 ofs = 0; | 645 | u32 ofs = 0; |
@@ -662,8 +655,6 @@ static void printk_buf(int level, const u8 *data, u32 len) | |||
662 | } | 655 | } |
663 | } | 656 | } |
664 | 657 | ||
665 | |||
666 | |||
667 | #define MAX_RESET_BACKOFF 10 | 658 | #define MAX_RESET_BACKOFF 10 |
668 | 659 | ||
669 | static inline void schedule_reset(struct ipw2100_priv *priv) | 660 | static inline void schedule_reset(struct ipw2100_priv *priv) |
@@ -703,7 +694,7 @@ static inline void schedule_reset(struct ipw2100_priv *priv) | |||
703 | 694 | ||
704 | #define HOST_COMPLETE_TIMEOUT (2 * HZ) | 695 | #define HOST_COMPLETE_TIMEOUT (2 * HZ) |
705 | static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | 696 | static int ipw2100_hw_send_command(struct ipw2100_priv *priv, |
706 | struct host_command * cmd) | 697 | struct host_command *cmd) |
707 | { | 698 | { |
708 | struct list_head *element; | 699 | struct list_head *element; |
709 | struct ipw2100_tx_packet *packet; | 700 | struct ipw2100_tx_packet *packet; |
@@ -713,25 +704,28 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
713 | IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", | 704 | IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", |
714 | command_types[cmd->host_command], cmd->host_command, | 705 | command_types[cmd->host_command], cmd->host_command, |
715 | cmd->host_command_length); | 706 | cmd->host_command_length); |
716 | printk_buf(IPW_DL_HC, (u8*)cmd->host_command_parameters, | 707 | printk_buf(IPW_DL_HC, (u8 *) cmd->host_command_parameters, |
717 | cmd->host_command_length); | 708 | cmd->host_command_length); |
718 | 709 | ||
719 | spin_lock_irqsave(&priv->low_lock, flags); | 710 | spin_lock_irqsave(&priv->low_lock, flags); |
720 | 711 | ||
721 | if (priv->fatal_error) { | 712 | if (priv->fatal_error) { |
722 | IPW_DEBUG_INFO("Attempt to send command while hardware in fatal error condition.\n"); | 713 | IPW_DEBUG_INFO |
714 | ("Attempt to send command while hardware in fatal error condition.\n"); | ||
723 | err = -EIO; | 715 | err = -EIO; |
724 | goto fail_unlock; | 716 | goto fail_unlock; |
725 | } | 717 | } |
726 | 718 | ||
727 | if (!(priv->status & STATUS_RUNNING)) { | 719 | if (!(priv->status & STATUS_RUNNING)) { |
728 | IPW_DEBUG_INFO("Attempt to send command while hardware is not running.\n"); | 720 | IPW_DEBUG_INFO |
721 | ("Attempt to send command while hardware is not running.\n"); | ||
729 | err = -EIO; | 722 | err = -EIO; |
730 | goto fail_unlock; | 723 | goto fail_unlock; |
731 | } | 724 | } |
732 | 725 | ||
733 | if (priv->status & STATUS_CMD_ACTIVE) { | 726 | if (priv->status & STATUS_CMD_ACTIVE) { |
734 | IPW_DEBUG_INFO("Attempt to send command while another command is pending.\n"); | 727 | IPW_DEBUG_INFO |
728 | ("Attempt to send command while another command is pending.\n"); | ||
735 | err = -EBUSY; | 729 | err = -EBUSY; |
736 | goto fail_unlock; | 730 | goto fail_unlock; |
737 | } | 731 | } |
@@ -752,7 +746,8 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
752 | /* initialize the firmware command packet */ | 746 | /* initialize the firmware command packet */ |
753 | packet->info.c_struct.cmd->host_command_reg = cmd->host_command; | 747 | packet->info.c_struct.cmd->host_command_reg = cmd->host_command; |
754 | packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; | 748 | packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; |
755 | packet->info.c_struct.cmd->host_command_len_reg = cmd->host_command_length; | 749 | packet->info.c_struct.cmd->host_command_len_reg = |
750 | cmd->host_command_length; | ||
756 | packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; | 751 | packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; |
757 | 752 | ||
758 | memcpy(packet->info.c_struct.cmd->host_command_params_reg, | 753 | memcpy(packet->info.c_struct.cmd->host_command_params_reg, |
@@ -776,13 +771,15 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
776 | * then there is a problem. | 771 | * then there is a problem. |
777 | */ | 772 | */ |
778 | 773 | ||
779 | err = wait_event_interruptible_timeout( | 774 | err = |
780 | priv->wait_command_queue, !(priv->status & STATUS_CMD_ACTIVE), | 775 | wait_event_interruptible_timeout(priv->wait_command_queue, |
781 | HOST_COMPLETE_TIMEOUT); | 776 | !(priv-> |
777 | status & STATUS_CMD_ACTIVE), | ||
778 | HOST_COMPLETE_TIMEOUT); | ||
782 | 779 | ||
783 | if (err == 0) { | 780 | if (err == 0) { |
784 | IPW_DEBUG_INFO("Command completion failed out after %dms.\n", | 781 | IPW_DEBUG_INFO("Command completion failed out after %dms.\n", |
785 | HOST_COMPLETE_TIMEOUT / (HZ / 100)); | 782 | 1000 * (HOST_COMPLETE_TIMEOUT / HZ)); |
786 | priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; | 783 | priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; |
787 | priv->status &= ~STATUS_CMD_ACTIVE; | 784 | priv->status &= ~STATUS_CMD_ACTIVE; |
788 | schedule_reset(priv); | 785 | schedule_reset(priv); |
@@ -804,13 +801,12 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
804 | 801 | ||
805 | return 0; | 802 | return 0; |
806 | 803 | ||
807 | fail_unlock: | 804 | fail_unlock: |
808 | spin_unlock_irqrestore(&priv->low_lock, flags); | 805 | spin_unlock_irqrestore(&priv->low_lock, flags); |
809 | 806 | ||
810 | return err; | 807 | return err; |
811 | } | 808 | } |
812 | 809 | ||
813 | |||
814 | /* | 810 | /* |
815 | * Verify the values and data access of the hardware | 811 | * Verify the values and data access of the hardware |
816 | * No locks needed or used. No functions called. | 812 | * No locks needed or used. No functions called. |
@@ -825,8 +821,7 @@ static int ipw2100_verify(struct ipw2100_priv *priv) | |||
825 | 821 | ||
826 | /* Domain 0 check - all values should be DOA_DEBUG */ | 822 | /* Domain 0 check - all values should be DOA_DEBUG */ |
827 | for (address = IPW_REG_DOA_DEBUG_AREA_START; | 823 | for (address = IPW_REG_DOA_DEBUG_AREA_START; |
828 | address < IPW_REG_DOA_DEBUG_AREA_END; | 824 | address < IPW_REG_DOA_DEBUG_AREA_END; address += sizeof(u32)) { |
829 | address += sizeof(u32)) { | ||
830 | read_register(priv->net_dev, address, &data1); | 825 | read_register(priv->net_dev, address, &data1); |
831 | if (data1 != IPW_DATA_DOA_DEBUG_VALUE) | 826 | if (data1 != IPW_DATA_DOA_DEBUG_VALUE) |
832 | return -EIO; | 827 | return -EIO; |
@@ -898,7 +893,6 @@ static int ipw2100_wait_for_card_state(struct ipw2100_priv *priv, int state) | |||
898 | return -EIO; | 893 | return -EIO; |
899 | } | 894 | } |
900 | 895 | ||
901 | |||
902 | /********************************************************************* | 896 | /********************************************************************* |
903 | Procedure : sw_reset_and_clock | 897 | Procedure : sw_reset_and_clock |
904 | Purpose : Asserts s/w reset, asserts clock initialization | 898 | Purpose : Asserts s/w reset, asserts clock initialization |
@@ -975,17 +969,16 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
975 | 969 | ||
976 | if (priv->fatal_error) { | 970 | if (priv->fatal_error) { |
977 | IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " | 971 | IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " |
978 | "fatal error %d. Interface must be brought down.\n", | 972 | "fatal error %d. Interface must be brought down.\n", |
979 | priv->net_dev->name, priv->fatal_error); | 973 | priv->net_dev->name, priv->fatal_error); |
980 | return -EINVAL; | 974 | return -EINVAL; |
981 | } | 975 | } |
982 | |||
983 | #ifdef CONFIG_PM | 976 | #ifdef CONFIG_PM |
984 | if (!ipw2100_firmware.version) { | 977 | if (!ipw2100_firmware.version) { |
985 | err = ipw2100_get_firmware(priv, &ipw2100_firmware); | 978 | err = ipw2100_get_firmware(priv, &ipw2100_firmware); |
986 | if (err) { | 979 | if (err) { |
987 | IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", | 980 | IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", |
988 | priv->net_dev->name, err); | 981 | priv->net_dev->name, err); |
989 | priv->fatal_error = IPW2100_ERR_FW_LOAD; | 982 | priv->fatal_error = IPW2100_ERR_FW_LOAD; |
990 | goto fail; | 983 | goto fail; |
991 | } | 984 | } |
@@ -994,7 +987,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
994 | err = ipw2100_get_firmware(priv, &ipw2100_firmware); | 987 | err = ipw2100_get_firmware(priv, &ipw2100_firmware); |
995 | if (err) { | 988 | if (err) { |
996 | IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", | 989 | IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", |
997 | priv->net_dev->name, err); | 990 | priv->net_dev->name, err); |
998 | priv->fatal_error = IPW2100_ERR_FW_LOAD; | 991 | priv->fatal_error = IPW2100_ERR_FW_LOAD; |
999 | goto fail; | 992 | goto fail; |
1000 | } | 993 | } |
@@ -1005,21 +998,20 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
1005 | err = sw_reset_and_clock(priv); | 998 | err = sw_reset_and_clock(priv); |
1006 | if (err) { | 999 | if (err) { |
1007 | IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", | 1000 | IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", |
1008 | priv->net_dev->name, err); | 1001 | priv->net_dev->name, err); |
1009 | goto fail; | 1002 | goto fail; |
1010 | } | 1003 | } |
1011 | 1004 | ||
1012 | err = ipw2100_verify(priv); | 1005 | err = ipw2100_verify(priv); |
1013 | if (err) { | 1006 | if (err) { |
1014 | IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", | 1007 | IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", |
1015 | priv->net_dev->name, err); | 1008 | priv->net_dev->name, err); |
1016 | goto fail; | 1009 | goto fail; |
1017 | } | 1010 | } |
1018 | 1011 | ||
1019 | /* Hold ARC */ | 1012 | /* Hold ARC */ |
1020 | write_nic_dword(priv->net_dev, | 1013 | write_nic_dword(priv->net_dev, |
1021 | IPW_INTERNAL_REGISTER_HALT_AND_RESET, | 1014 | IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x80000000); |
1022 | 0x80000000); | ||
1023 | 1015 | ||
1024 | /* allow ARC to run */ | 1016 | /* allow ARC to run */ |
1025 | write_register(priv->net_dev, IPW_REG_RESET_REG, 0); | 1017 | write_register(priv->net_dev, IPW_REG_RESET_REG, 0); |
@@ -1034,13 +1026,13 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
1034 | 1026 | ||
1035 | /* release ARC */ | 1027 | /* release ARC */ |
1036 | write_nic_dword(priv->net_dev, | 1028 | write_nic_dword(priv->net_dev, |
1037 | IPW_INTERNAL_REGISTER_HALT_AND_RESET, | 1029 | IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x00000000); |
1038 | 0x00000000); | ||
1039 | 1030 | ||
1040 | /* s/w reset and clock stabilization (again!!!) */ | 1031 | /* s/w reset and clock stabilization (again!!!) */ |
1041 | err = sw_reset_and_clock(priv); | 1032 | err = sw_reset_and_clock(priv); |
1042 | if (err) { | 1033 | if (err) { |
1043 | printk(KERN_ERR DRV_NAME ": %s: sw_reset_and_clock failed: %d\n", | 1034 | printk(KERN_ERR DRV_NAME |
1035 | ": %s: sw_reset_and_clock failed: %d\n", | ||
1044 | priv->net_dev->name, err); | 1036 | priv->net_dev->name, err); |
1045 | goto fail; | 1037 | goto fail; |
1046 | } | 1038 | } |
@@ -1049,10 +1041,9 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
1049 | err = ipw2100_fw_download(priv, &ipw2100_firmware); | 1041 | err = ipw2100_fw_download(priv, &ipw2100_firmware); |
1050 | if (err) { | 1042 | if (err) { |
1051 | IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", | 1043 | IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", |
1052 | priv->net_dev->name, err); | 1044 | priv->net_dev->name, err); |
1053 | goto fail; | 1045 | goto fail; |
1054 | } | 1046 | } |
1055 | |||
1056 | #ifndef CONFIG_PM | 1047 | #ifndef CONFIG_PM |
1057 | /* | 1048 | /* |
1058 | * When the .resume method of the driver is called, the other | 1049 | * When the .resume method of the driver is called, the other |
@@ -1084,7 +1075,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
1084 | 1075 | ||
1085 | return 0; | 1076 | return 0; |
1086 | 1077 | ||
1087 | fail: | 1078 | fail: |
1088 | ipw2100_release_firmware(priv, &ipw2100_firmware); | 1079 | ipw2100_release_firmware(priv, &ipw2100_firmware); |
1089 | return err; | 1080 | return err; |
1090 | } | 1081 | } |
@@ -1105,7 +1096,6 @@ static inline void ipw2100_disable_interrupts(struct ipw2100_priv *priv) | |||
1105 | write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); | 1096 | write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); |
1106 | } | 1097 | } |
1107 | 1098 | ||
1108 | |||
1109 | static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) | 1099 | static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) |
1110 | { | 1100 | { |
1111 | struct ipw2100_ordinals *ord = &priv->ordinals; | 1101 | struct ipw2100_ordinals *ord = &priv->ordinals; |
@@ -1177,11 +1167,10 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) | |||
1177 | * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 | 1167 | * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 |
1178 | */ | 1168 | */ |
1179 | len = sizeof(addr); | 1169 | len = sizeof(addr); |
1180 | if (ipw2100_get_ordinal( | 1170 | if (ipw2100_get_ordinal |
1181 | priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, | 1171 | (priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, &addr, &len)) { |
1182 | &addr, &len)) { | ||
1183 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1172 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1184 | __LINE__); | 1173 | __LINE__); |
1185 | return -EIO; | 1174 | return -EIO; |
1186 | } | 1175 | } |
1187 | 1176 | ||
@@ -1194,7 +1183,7 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) | |||
1194 | priv->eeprom_version = (val >> 24) & 0xFF; | 1183 | priv->eeprom_version = (val >> 24) & 0xFF; |
1195 | IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); | 1184 | IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); |
1196 | 1185 | ||
1197 | /* | 1186 | /* |
1198 | * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware | 1187 | * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware |
1199 | * | 1188 | * |
1200 | * notice that the EEPROM bit is reverse polarity, i.e. | 1189 | * notice that the EEPROM bit is reverse polarity, i.e. |
@@ -1206,8 +1195,7 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) | |||
1206 | priv->hw_features |= HW_FEATURE_RFKILL; | 1195 | priv->hw_features |= HW_FEATURE_RFKILL; |
1207 | 1196 | ||
1208 | IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", | 1197 | IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", |
1209 | (priv->hw_features & HW_FEATURE_RFKILL) ? | 1198 | (priv->hw_features & HW_FEATURE_RFKILL) ? "" : "not "); |
1210 | "" : "not "); | ||
1211 | 1199 | ||
1212 | return 0; | 1200 | return 0; |
1213 | } | 1201 | } |
@@ -1234,7 +1222,8 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) | |||
1234 | * fw & dino ucode | 1222 | * fw & dino ucode |
1235 | */ | 1223 | */ |
1236 | if (ipw2100_download_firmware(priv)) { | 1224 | if (ipw2100_download_firmware(priv)) { |
1237 | printk(KERN_ERR DRV_NAME ": %s: Failed to power on the adapter.\n", | 1225 | printk(KERN_ERR DRV_NAME |
1226 | ": %s: Failed to power on the adapter.\n", | ||
1238 | priv->net_dev->name); | 1227 | priv->net_dev->name); |
1239 | return -EIO; | 1228 | return -EIO; |
1240 | } | 1229 | } |
@@ -1293,7 +1282,8 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) | |||
1293 | i ? "SUCCESS" : "FAILED"); | 1282 | i ? "SUCCESS" : "FAILED"); |
1294 | 1283 | ||
1295 | if (!i) { | 1284 | if (!i) { |
1296 | printk(KERN_WARNING DRV_NAME ": %s: Firmware did not initialize.\n", | 1285 | printk(KERN_WARNING DRV_NAME |
1286 | ": %s: Firmware did not initialize.\n", | ||
1297 | priv->net_dev->name); | 1287 | priv->net_dev->name); |
1298 | return -EIO; | 1288 | return -EIO; |
1299 | } | 1289 | } |
@@ -1326,7 +1316,6 @@ static inline void ipw2100_reset_fatalerror(struct ipw2100_priv *priv) | |||
1326 | priv->fatal_error = 0; | 1316 | priv->fatal_error = 0; |
1327 | } | 1317 | } |
1328 | 1318 | ||
1329 | |||
1330 | /* NOTE: Our interrupt is disabled when this method is called */ | 1319 | /* NOTE: Our interrupt is disabled when this method is called */ |
1331 | static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) | 1320 | static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) |
1332 | { | 1321 | { |
@@ -1350,19 +1339,19 @@ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) | |||
1350 | 1339 | ||
1351 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) | 1340 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) |
1352 | break; | 1341 | break; |
1353 | } while(i--); | 1342 | } while (i--); |
1354 | 1343 | ||
1355 | priv->status &= ~STATUS_RESET_PENDING; | 1344 | priv->status &= ~STATUS_RESET_PENDING; |
1356 | 1345 | ||
1357 | if (!i) { | 1346 | if (!i) { |
1358 | IPW_DEBUG_INFO("exit - waited too long for master assert stop\n"); | 1347 | IPW_DEBUG_INFO |
1348 | ("exit - waited too long for master assert stop\n"); | ||
1359 | return -EIO; | 1349 | return -EIO; |
1360 | } | 1350 | } |
1361 | 1351 | ||
1362 | write_register(priv->net_dev, IPW_REG_RESET_REG, | 1352 | write_register(priv->net_dev, IPW_REG_RESET_REG, |
1363 | IPW_AUX_HOST_RESET_REG_SW_RESET); | 1353 | IPW_AUX_HOST_RESET_REG_SW_RESET); |
1364 | 1354 | ||
1365 | |||
1366 | /* Reset any fatal_error conditions */ | 1355 | /* Reset any fatal_error conditions */ |
1367 | ipw2100_reset_fatalerror(priv); | 1356 | ipw2100_reset_fatalerror(priv); |
1368 | 1357 | ||
@@ -1415,7 +1404,6 @@ static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) | |||
1415 | return -EIO; | 1404 | return -EIO; |
1416 | } | 1405 | } |
1417 | 1406 | ||
1418 | |||
1419 | static int ipw2100_enable_adapter(struct ipw2100_priv *priv) | 1407 | static int ipw2100_enable_adapter(struct ipw2100_priv *priv) |
1420 | { | 1408 | { |
1421 | struct host_command cmd = { | 1409 | struct host_command cmd = { |
@@ -1445,9 +1433,8 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv) | |||
1445 | 1433 | ||
1446 | err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); | 1434 | err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); |
1447 | if (err) { | 1435 | if (err) { |
1448 | IPW_DEBUG_INFO( | 1436 | IPW_DEBUG_INFO("%s: card not responding to init command.\n", |
1449 | "%s: card not responding to init command.\n", | 1437 | priv->net_dev->name); |
1450 | priv->net_dev->name); | ||
1451 | goto fail_up; | 1438 | goto fail_up; |
1452 | } | 1439 | } |
1453 | 1440 | ||
@@ -1456,7 +1443,7 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv) | |||
1456 | queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2); | 1443 | queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2); |
1457 | } | 1444 | } |
1458 | 1445 | ||
1459 | fail_up: | 1446 | fail_up: |
1460 | up(&priv->adapter_sem); | 1447 | up(&priv->adapter_sem); |
1461 | return err; | 1448 | return err; |
1462 | } | 1449 | } |
@@ -1488,7 +1475,8 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) | |||
1488 | 1475 | ||
1489 | err = ipw2100_hw_phy_off(priv); | 1476 | err = ipw2100_hw_phy_off(priv); |
1490 | if (err) | 1477 | if (err) |
1491 | printk(KERN_WARNING DRV_NAME ": Error disabling radio %d\n", err); | 1478 | printk(KERN_WARNING DRV_NAME |
1479 | ": Error disabling radio %d\n", err); | ||
1492 | 1480 | ||
1493 | /* | 1481 | /* |
1494 | * If in D0-standby mode going directly to D3 may cause a | 1482 | * If in D0-standby mode going directly to D3 may cause a |
@@ -1566,7 +1554,6 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) | |||
1566 | return 0; | 1554 | return 0; |
1567 | } | 1555 | } |
1568 | 1556 | ||
1569 | |||
1570 | static int ipw2100_disable_adapter(struct ipw2100_priv *priv) | 1557 | static int ipw2100_disable_adapter(struct ipw2100_priv *priv) |
1571 | { | 1558 | { |
1572 | struct host_command cmd = { | 1559 | struct host_command cmd = { |
@@ -1593,19 +1580,21 @@ static int ipw2100_disable_adapter(struct ipw2100_priv *priv) | |||
1593 | 1580 | ||
1594 | err = ipw2100_hw_send_command(priv, &cmd); | 1581 | err = ipw2100_hw_send_command(priv, &cmd); |
1595 | if (err) { | 1582 | if (err) { |
1596 | printk(KERN_WARNING DRV_NAME ": exit - failed to send CARD_DISABLE command\n"); | 1583 | printk(KERN_WARNING DRV_NAME |
1584 | ": exit - failed to send CARD_DISABLE command\n"); | ||
1597 | goto fail_up; | 1585 | goto fail_up; |
1598 | } | 1586 | } |
1599 | 1587 | ||
1600 | err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); | 1588 | err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); |
1601 | if (err) { | 1589 | if (err) { |
1602 | printk(KERN_WARNING DRV_NAME ": exit - card failed to change to DISABLED\n"); | 1590 | printk(KERN_WARNING DRV_NAME |
1591 | ": exit - card failed to change to DISABLED\n"); | ||
1603 | goto fail_up; | 1592 | goto fail_up; |
1604 | } | 1593 | } |
1605 | 1594 | ||
1606 | IPW_DEBUG_INFO("TODO: implement scan state machine\n"); | 1595 | IPW_DEBUG_INFO("TODO: implement scan state machine\n"); |
1607 | 1596 | ||
1608 | fail_up: | 1597 | fail_up: |
1609 | up(&priv->adapter_sem); | 1598 | up(&priv->adapter_sem); |
1610 | return err; | 1599 | return err; |
1611 | } | 1600 | } |
@@ -1627,7 +1616,7 @@ static int ipw2100_set_scan_options(struct ipw2100_priv *priv) | |||
1627 | 1616 | ||
1628 | if (!(priv->config & CFG_ASSOCIATE)) | 1617 | if (!(priv->config & CFG_ASSOCIATE)) |
1629 | cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; | 1618 | cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; |
1630 | if ((priv->sec.flags & SEC_ENABLED) && priv->sec.enabled) | 1619 | if ((priv->ieee->sec.flags & SEC_ENABLED) && priv->ieee->sec.enabled) |
1631 | cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; | 1620 | cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; |
1632 | if (priv->config & CFG_PASSIVE_SCAN) | 1621 | if (priv->config & CFG_PASSIVE_SCAN) |
1633 | cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; | 1622 | cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; |
@@ -1709,8 +1698,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1709 | (priv->status & STATUS_RESET_PENDING)) { | 1698 | (priv->status & STATUS_RESET_PENDING)) { |
1710 | /* Power cycle the card ... */ | 1699 | /* Power cycle the card ... */ |
1711 | if (ipw2100_power_cycle_adapter(priv)) { | 1700 | if (ipw2100_power_cycle_adapter(priv)) { |
1712 | printk(KERN_WARNING DRV_NAME ": %s: Could not cycle adapter.\n", | 1701 | printk(KERN_WARNING DRV_NAME |
1713 | priv->net_dev->name); | 1702 | ": %s: Could not cycle adapter.\n", |
1703 | priv->net_dev->name); | ||
1714 | rc = 1; | 1704 | rc = 1; |
1715 | goto exit; | 1705 | goto exit; |
1716 | } | 1706 | } |
@@ -1719,8 +1709,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1719 | 1709 | ||
1720 | /* Load the firmware, start the clocks, etc. */ | 1710 | /* Load the firmware, start the clocks, etc. */ |
1721 | if (ipw2100_start_adapter(priv)) { | 1711 | if (ipw2100_start_adapter(priv)) { |
1722 | printk(KERN_ERR DRV_NAME ": %s: Failed to start the firmware.\n", | 1712 | printk(KERN_ERR DRV_NAME |
1723 | priv->net_dev->name); | 1713 | ": %s: Failed to start the firmware.\n", |
1714 | priv->net_dev->name); | ||
1724 | rc = 1; | 1715 | rc = 1; |
1725 | goto exit; | 1716 | goto exit; |
1726 | } | 1717 | } |
@@ -1729,16 +1720,18 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1729 | 1720 | ||
1730 | /* Determine capabilities of this particular HW configuration */ | 1721 | /* Determine capabilities of this particular HW configuration */ |
1731 | if (ipw2100_get_hw_features(priv)) { | 1722 | if (ipw2100_get_hw_features(priv)) { |
1732 | printk(KERN_ERR DRV_NAME ": %s: Failed to determine HW features.\n", | 1723 | printk(KERN_ERR DRV_NAME |
1733 | priv->net_dev->name); | 1724 | ": %s: Failed to determine HW features.\n", |
1725 | priv->net_dev->name); | ||
1734 | rc = 1; | 1726 | rc = 1; |
1735 | goto exit; | 1727 | goto exit; |
1736 | } | 1728 | } |
1737 | 1729 | ||
1738 | lock = LOCK_NONE; | 1730 | lock = LOCK_NONE; |
1739 | if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { | 1731 | if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { |
1740 | printk(KERN_ERR DRV_NAME ": %s: Failed to clear ordinal lock.\n", | 1732 | printk(KERN_ERR DRV_NAME |
1741 | priv->net_dev->name); | 1733 | ": %s: Failed to clear ordinal lock.\n", |
1734 | priv->net_dev->name); | ||
1742 | rc = 1; | 1735 | rc = 1; |
1743 | goto exit; | 1736 | goto exit; |
1744 | } | 1737 | } |
@@ -1764,7 +1757,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1764 | * HOST_COMPLETE */ | 1757 | * HOST_COMPLETE */ |
1765 | if (ipw2100_adapter_setup(priv)) { | 1758 | if (ipw2100_adapter_setup(priv)) { |
1766 | printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", | 1759 | printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", |
1767 | priv->net_dev->name); | 1760 | priv->net_dev->name); |
1768 | rc = 1; | 1761 | rc = 1; |
1769 | goto exit; | 1762 | goto exit; |
1770 | } | 1763 | } |
@@ -1773,20 +1766,19 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1773 | /* Enable the adapter - sends HOST_COMPLETE */ | 1766 | /* Enable the adapter - sends HOST_COMPLETE */ |
1774 | if (ipw2100_enable_adapter(priv)) { | 1767 | if (ipw2100_enable_adapter(priv)) { |
1775 | printk(KERN_ERR DRV_NAME ": " | 1768 | printk(KERN_ERR DRV_NAME ": " |
1776 | "%s: failed in call to enable adapter.\n", | 1769 | "%s: failed in call to enable adapter.\n", |
1777 | priv->net_dev->name); | 1770 | priv->net_dev->name); |
1778 | ipw2100_hw_stop_adapter(priv); | 1771 | ipw2100_hw_stop_adapter(priv); |
1779 | rc = 1; | 1772 | rc = 1; |
1780 | goto exit; | 1773 | goto exit; |
1781 | } | 1774 | } |
1782 | 1775 | ||
1783 | |||
1784 | /* Start a scan . . . */ | 1776 | /* Start a scan . . . */ |
1785 | ipw2100_set_scan_options(priv); | 1777 | ipw2100_set_scan_options(priv); |
1786 | ipw2100_start_scan(priv); | 1778 | ipw2100_start_scan(priv); |
1787 | } | 1779 | } |
1788 | 1780 | ||
1789 | exit: | 1781 | exit: |
1790 | return rc; | 1782 | return rc; |
1791 | } | 1783 | } |
1792 | 1784 | ||
@@ -1802,8 +1794,7 @@ static void ipw2100_down(struct ipw2100_priv *priv) | |||
1802 | unsigned long flags; | 1794 | unsigned long flags; |
1803 | union iwreq_data wrqu = { | 1795 | union iwreq_data wrqu = { |
1804 | .ap_addr = { | 1796 | .ap_addr = { |
1805 | .sa_family = ARPHRD_ETHER | 1797 | .sa_family = ARPHRD_ETHER} |
1806 | } | ||
1807 | }; | 1798 | }; |
1808 | int associated = priv->status & STATUS_ASSOCIATED; | 1799 | int associated = priv->status & STATUS_ASSOCIATED; |
1809 | 1800 | ||
@@ -1842,7 +1833,7 @@ static void ipw2100_down(struct ipw2100_priv *priv) | |||
1842 | 1833 | ||
1843 | #ifdef ACPI_CSTATE_LIMIT_DEFINED | 1834 | #ifdef ACPI_CSTATE_LIMIT_DEFINED |
1844 | if (priv->config & CFG_C3_DISABLED) { | 1835 | if (priv->config & CFG_C3_DISABLED) { |
1845 | IPW_DEBUG_INFO(DRV_NAME ": Resetting C3 transitions.\n"); | 1836 | IPW_DEBUG_INFO(": Resetting C3 transitions.\n"); |
1846 | acpi_set_cstate_limit(priv->cstate_limit); | 1837 | acpi_set_cstate_limit(priv->cstate_limit); |
1847 | priv->config &= ~CFG_C3_DISABLED; | 1838 | priv->config &= ~CFG_C3_DISABLED; |
1848 | } | 1839 | } |
@@ -1862,14 +1853,12 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) | |||
1862 | unsigned long flags; | 1853 | unsigned long flags; |
1863 | union iwreq_data wrqu = { | 1854 | union iwreq_data wrqu = { |
1864 | .ap_addr = { | 1855 | .ap_addr = { |
1865 | .sa_family = ARPHRD_ETHER | 1856 | .sa_family = ARPHRD_ETHER} |
1866 | } | ||
1867 | }; | 1857 | }; |
1868 | int associated = priv->status & STATUS_ASSOCIATED; | 1858 | int associated = priv->status & STATUS_ASSOCIATED; |
1869 | 1859 | ||
1870 | spin_lock_irqsave(&priv->low_lock, flags); | 1860 | spin_lock_irqsave(&priv->low_lock, flags); |
1871 | IPW_DEBUG_INFO(DRV_NAME ": %s: Restarting adapter.\n", | 1861 | IPW_DEBUG_INFO(": %s: Restarting adapter.\n", priv->net_dev->name); |
1872 | priv->net_dev->name); | ||
1873 | priv->resets++; | 1862 | priv->resets++; |
1874 | priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); | 1863 | priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); |
1875 | priv->status |= STATUS_SECURITY_UPDATED; | 1864 | priv->status |= STATUS_SECURITY_UPDATED; |
@@ -1894,7 +1883,6 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) | |||
1894 | 1883 | ||
1895 | } | 1884 | } |
1896 | 1885 | ||
1897 | |||
1898 | static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | 1886 | static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) |
1899 | { | 1887 | { |
1900 | 1888 | ||
@@ -1904,7 +1892,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1904 | u32 txrate; | 1892 | u32 txrate; |
1905 | u32 chan; | 1893 | u32 chan; |
1906 | char *txratename; | 1894 | char *txratename; |
1907 | u8 bssid[ETH_ALEN]; | 1895 | u8 bssid[ETH_ALEN]; |
1908 | 1896 | ||
1909 | /* | 1897 | /* |
1910 | * TBD: BSSID is usually 00:00:00:00:00:00 here and not | 1898 | * TBD: BSSID is usually 00:00:00:00:00:00 here and not |
@@ -1918,16 +1906,15 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1918 | essid, &essid_len); | 1906 | essid, &essid_len); |
1919 | if (ret) { | 1907 | if (ret) { |
1920 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1908 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1921 | __LINE__); | 1909 | __LINE__); |
1922 | return; | 1910 | return; |
1923 | } | 1911 | } |
1924 | 1912 | ||
1925 | len = sizeof(u32); | 1913 | len = sizeof(u32); |
1926 | ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, | 1914 | ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &txrate, &len); |
1927 | &txrate, &len); | ||
1928 | if (ret) { | 1915 | if (ret) { |
1929 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1916 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1930 | __LINE__); | 1917 | __LINE__); |
1931 | return; | 1918 | return; |
1932 | } | 1919 | } |
1933 | 1920 | ||
@@ -1935,19 +1922,18 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1935 | ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); | 1922 | ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); |
1936 | if (ret) { | 1923 | if (ret) { |
1937 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1924 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1938 | __LINE__); | 1925 | __LINE__); |
1939 | return; | 1926 | return; |
1940 | } | 1927 | } |
1941 | len = ETH_ALEN; | 1928 | len = ETH_ALEN; |
1942 | ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len); | 1929 | ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len); |
1943 | if (ret) { | 1930 | if (ret) { |
1944 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1931 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1945 | __LINE__); | 1932 | __LINE__); |
1946 | return; | 1933 | return; |
1947 | } | 1934 | } |
1948 | memcpy(priv->ieee->bssid, bssid, ETH_ALEN); | 1935 | memcpy(priv->ieee->bssid, bssid, ETH_ALEN); |
1949 | 1936 | ||
1950 | |||
1951 | switch (txrate) { | 1937 | switch (txrate) { |
1952 | case TX_RATE_1_MBIT: | 1938 | case TX_RATE_1_MBIT: |
1953 | txratename = "1Mbps"; | 1939 | txratename = "1Mbps"; |
@@ -1974,7 +1960,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1974 | 1960 | ||
1975 | /* now we copy read ssid into dev */ | 1961 | /* now we copy read ssid into dev */ |
1976 | if (!(priv->config & CFG_STATIC_ESSID)) { | 1962 | if (!(priv->config & CFG_STATIC_ESSID)) { |
1977 | priv->essid_len = min((u8)essid_len, (u8)IW_ESSID_MAX_SIZE); | 1963 | priv->essid_len = min((u8) essid_len, (u8) IW_ESSID_MAX_SIZE); |
1978 | memcpy(priv->essid, essid, priv->essid_len); | 1964 | memcpy(priv->essid, essid, priv->essid_len); |
1979 | } | 1965 | } |
1980 | priv->channel = chan; | 1966 | priv->channel = chan; |
@@ -1986,7 +1972,6 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1986 | queue_delayed_work(priv->workqueue, &priv->wx_event_work, HZ / 10); | 1972 | queue_delayed_work(priv->workqueue, &priv->wx_event_work, HZ / 10); |
1987 | } | 1973 | } |
1988 | 1974 | ||
1989 | |||
1990 | static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, | 1975 | static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, |
1991 | int length, int batch_mode) | 1976 | int length, int batch_mode) |
1992 | { | 1977 | { |
@@ -2001,8 +1986,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, | |||
2001 | IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); | 1986 | IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); |
2002 | 1987 | ||
2003 | if (ssid_len) | 1988 | if (ssid_len) |
2004 | memcpy((char*)cmd.host_command_parameters, | 1989 | memcpy(cmd.host_command_parameters, essid, ssid_len); |
2005 | essid, ssid_len); | ||
2006 | 1990 | ||
2007 | if (!batch_mode) { | 1991 | if (!batch_mode) { |
2008 | err = ipw2100_disable_adapter(priv); | 1992 | err = ipw2100_disable_adapter(priv); |
@@ -2014,7 +1998,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, | |||
2014 | * disable auto association -- so we cheat by setting a bogus SSID */ | 1998 | * disable auto association -- so we cheat by setting a bogus SSID */ |
2015 | if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { | 1999 | if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { |
2016 | int i; | 2000 | int i; |
2017 | u8 *bogus = (u8*)cmd.host_command_parameters; | 2001 | u8 *bogus = (u8 *) cmd.host_command_parameters; |
2018 | for (i = 0; i < IW_ESSID_MAX_SIZE; i++) | 2002 | for (i = 0; i < IW_ESSID_MAX_SIZE; i++) |
2019 | bogus[i] = 0x18 + i; | 2003 | bogus[i] = 0x18 + i; |
2020 | cmd.host_command_length = IW_ESSID_MAX_SIZE; | 2004 | cmd.host_command_length = IW_ESSID_MAX_SIZE; |
@@ -2025,8 +2009,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, | |||
2025 | 2009 | ||
2026 | err = ipw2100_hw_send_command(priv, &cmd); | 2010 | err = ipw2100_hw_send_command(priv, &cmd); |
2027 | if (!err) { | 2011 | if (!err) { |
2028 | memset(priv->essid + ssid_len, 0, | 2012 | memset(priv->essid + ssid_len, 0, IW_ESSID_MAX_SIZE - ssid_len); |
2029 | IW_ESSID_MAX_SIZE - ssid_len); | ||
2030 | memcpy(priv->essid, essid, ssid_len); | 2013 | memcpy(priv->essid, essid, ssid_len); |
2031 | priv->essid_len = ssid_len; | 2014 | priv->essid_len = ssid_len; |
2032 | } | 2015 | } |
@@ -2071,14 +2054,14 @@ static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status) | |||
2071 | static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) | 2054 | static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) |
2072 | { | 2055 | { |
2073 | IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", | 2056 | IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", |
2074 | priv->net_dev->name); | 2057 | priv->net_dev->name); |
2075 | 2058 | ||
2076 | /* RF_KILL is now enabled (else we wouldn't be here) */ | 2059 | /* RF_KILL is now enabled (else we wouldn't be here) */ |
2077 | priv->status |= STATUS_RF_KILL_HW; | 2060 | priv->status |= STATUS_RF_KILL_HW; |
2078 | 2061 | ||
2079 | #ifdef ACPI_CSTATE_LIMIT_DEFINED | 2062 | #ifdef ACPI_CSTATE_LIMIT_DEFINED |
2080 | if (priv->config & CFG_C3_DISABLED) { | 2063 | if (priv->config & CFG_C3_DISABLED) { |
2081 | IPW_DEBUG_INFO(DRV_NAME ": Resetting C3 transitions.\n"); | 2064 | IPW_DEBUG_INFO(": Resetting C3 transitions.\n"); |
2082 | acpi_set_cstate_limit(priv->cstate_limit); | 2065 | acpi_set_cstate_limit(priv->cstate_limit); |
2083 | priv->config &= ~CFG_C3_DISABLED; | 2066 | priv->config &= ~CFG_C3_DISABLED; |
2084 | } | 2067 | } |
@@ -2102,16 +2085,16 @@ static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) | |||
2102 | #define IPW2100_HANDLER(v, f) { v, f, # v } | 2085 | #define IPW2100_HANDLER(v, f) { v, f, # v } |
2103 | struct ipw2100_status_indicator { | 2086 | struct ipw2100_status_indicator { |
2104 | int status; | 2087 | int status; |
2105 | void (*cb)(struct ipw2100_priv *priv, u32 status); | 2088 | void (*cb) (struct ipw2100_priv * priv, u32 status); |
2106 | char *name; | 2089 | char *name; |
2107 | }; | 2090 | }; |
2108 | #else | 2091 | #else |
2109 | #define IPW2100_HANDLER(v, f) { v, f } | 2092 | #define IPW2100_HANDLER(v, f) { v, f } |
2110 | struct ipw2100_status_indicator { | 2093 | struct ipw2100_status_indicator { |
2111 | int status; | 2094 | int status; |
2112 | void (*cb)(struct ipw2100_priv *priv, u32 status); | 2095 | void (*cb) (struct ipw2100_priv * priv, u32 status); |
2113 | }; | 2096 | }; |
2114 | #endif /* CONFIG_IPW_DEBUG */ | 2097 | #endif /* CONFIG_IPW_DEBUG */ |
2115 | 2098 | ||
2116 | static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) | 2099 | static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) |
2117 | { | 2100 | { |
@@ -2135,7 +2118,6 @@ static const struct ipw2100_status_indicator status_handlers[] = { | |||
2135 | IPW2100_HANDLER(-1, NULL) | 2118 | IPW2100_HANDLER(-1, NULL) |
2136 | }; | 2119 | }; |
2137 | 2120 | ||
2138 | |||
2139 | static void isr_status_change(struct ipw2100_priv *priv, int status) | 2121 | static void isr_status_change(struct ipw2100_priv *priv, int status) |
2140 | { | 2122 | { |
2141 | int i; | 2123 | int i; |
@@ -2153,7 +2135,7 @@ static void isr_status_change(struct ipw2100_priv *priv, int status) | |||
2153 | for (i = 0; status_handlers[i].status != -1; i++) { | 2135 | for (i = 0; status_handlers[i].status != -1; i++) { |
2154 | if (status == status_handlers[i].status) { | 2136 | if (status == status_handlers[i].status) { |
2155 | IPW_DEBUG_NOTIF("Status change: %s\n", | 2137 | IPW_DEBUG_NOTIF("Status change: %s\n", |
2156 | status_handlers[i].name); | 2138 | status_handlers[i].name); |
2157 | if (status_handlers[i].cb) | 2139 | if (status_handlers[i].cb) |
2158 | status_handlers[i].cb(priv, status); | 2140 | status_handlers[i].cb(priv, status); |
2159 | priv->wstats.status = status; | 2141 | priv->wstats.status = status; |
@@ -2164,9 +2146,8 @@ static void isr_status_change(struct ipw2100_priv *priv, int status) | |||
2164 | IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); | 2146 | IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); |
2165 | } | 2147 | } |
2166 | 2148 | ||
2167 | static void isr_rx_complete_command( | 2149 | static void isr_rx_complete_command(struct ipw2100_priv *priv, |
2168 | struct ipw2100_priv *priv, | 2150 | struct ipw2100_cmd_header *cmd) |
2169 | struct ipw2100_cmd_header *cmd) | ||
2170 | { | 2151 | { |
2171 | #ifdef CONFIG_IPW_DEBUG | 2152 | #ifdef CONFIG_IPW_DEBUG |
2172 | if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { | 2153 | if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { |
@@ -2196,10 +2177,8 @@ static const char *frame_types[] = { | |||
2196 | }; | 2177 | }; |
2197 | #endif | 2178 | #endif |
2198 | 2179 | ||
2199 | 2180 | static inline int ipw2100_alloc_skb(struct ipw2100_priv *priv, | |
2200 | static inline int ipw2100_alloc_skb( | 2181 | struct ipw2100_rx_packet *packet) |
2201 | struct ipw2100_priv *priv, | ||
2202 | struct ipw2100_rx_packet *packet) | ||
2203 | { | 2182 | { |
2204 | packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); | 2183 | packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); |
2205 | if (!packet->skb) | 2184 | if (!packet->skb) |
@@ -2215,7 +2194,6 @@ static inline int ipw2100_alloc_skb( | |||
2215 | return 0; | 2194 | return 0; |
2216 | } | 2195 | } |
2217 | 2196 | ||
2218 | |||
2219 | #define SEARCH_ERROR 0xffffffff | 2197 | #define SEARCH_ERROR 0xffffffff |
2220 | #define SEARCH_FAIL 0xfffffffe | 2198 | #define SEARCH_FAIL 0xfffffffe |
2221 | #define SEARCH_SUCCESS 0xfffffff0 | 2199 | #define SEARCH_SUCCESS 0xfffffff0 |
@@ -2229,10 +2207,10 @@ static inline int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) | |||
2229 | if (priv->snapshot[0]) | 2207 | if (priv->snapshot[0]) |
2230 | return 1; | 2208 | return 1; |
2231 | for (i = 0; i < 0x30; i++) { | 2209 | for (i = 0; i < 0x30; i++) { |
2232 | priv->snapshot[i] = (u8*)kmalloc(0x1000, GFP_ATOMIC); | 2210 | priv->snapshot[i] = (u8 *) kmalloc(0x1000, GFP_ATOMIC); |
2233 | if (!priv->snapshot[i]) { | 2211 | if (!priv->snapshot[i]) { |
2234 | IPW_DEBUG_INFO("%s: Error allocating snapshot " | 2212 | IPW_DEBUG_INFO("%s: Error allocating snapshot " |
2235 | "buffer %d\n", priv->net_dev->name, i); | 2213 | "buffer %d\n", priv->net_dev->name, i); |
2236 | while (i > 0) | 2214 | while (i > 0) |
2237 | kfree(priv->snapshot[--i]); | 2215 | kfree(priv->snapshot[--i]); |
2238 | priv->snapshot[0] = NULL; | 2216 | priv->snapshot[0] = NULL; |
@@ -2253,7 +2231,7 @@ static inline void ipw2100_snapshot_free(struct ipw2100_priv *priv) | |||
2253 | priv->snapshot[0] = NULL; | 2231 | priv->snapshot[0] = NULL; |
2254 | } | 2232 | } |
2255 | 2233 | ||
2256 | static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, | 2234 | static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, |
2257 | size_t len, int mode) | 2235 | size_t len, int mode) |
2258 | { | 2236 | { |
2259 | u32 i, j; | 2237 | u32 i, j; |
@@ -2270,9 +2248,9 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, | |||
2270 | for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { | 2248 | for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { |
2271 | read_nic_dword(priv->net_dev, i, &tmp); | 2249 | read_nic_dword(priv->net_dev, i, &tmp); |
2272 | if (mode == SEARCH_SNAPSHOT) | 2250 | if (mode == SEARCH_SNAPSHOT) |
2273 | *(u32 *)SNAPSHOT_ADDR(i) = tmp; | 2251 | *(u32 *) SNAPSHOT_ADDR(i) = tmp; |
2274 | if (ret == SEARCH_FAIL) { | 2252 | if (ret == SEARCH_FAIL) { |
2275 | d = (u8*)&tmp; | 2253 | d = (u8 *) & tmp; |
2276 | for (j = 0; j < 4; j++) { | 2254 | for (j = 0; j < 4; j++) { |
2277 | if (*s != *d) { | 2255 | if (*s != *d) { |
2278 | s = in_buf; | 2256 | s = in_buf; |
@@ -2310,8 +2288,7 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, | |||
2310 | static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; | 2288 | static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; |
2311 | #endif | 2289 | #endif |
2312 | 2290 | ||
2313 | static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, | 2291 | static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) |
2314 | int i) | ||
2315 | { | 2292 | { |
2316 | #ifdef CONFIG_IPW_DEBUG_C3 | 2293 | #ifdef CONFIG_IPW_DEBUG_C3 |
2317 | struct ipw2100_status *status = &priv->status_queue.drv[i]; | 2294 | struct ipw2100_status *status = &priv->status_queue.drv[i]; |
@@ -2322,11 +2299,11 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, | |||
2322 | int limit; | 2299 | int limit; |
2323 | #endif | 2300 | #endif |
2324 | 2301 | ||
2325 | IPW_DEBUG_INFO(DRV_NAME ": PCI latency error detected at " | 2302 | IPW_DEBUG_INFO(": PCI latency error detected at 0x%04zX.\n", |
2326 | "0x%04zX.\n", i * sizeof(struct ipw2100_status)); | 2303 | i * sizeof(struct ipw2100_status)); |
2327 | 2304 | ||
2328 | #ifdef ACPI_CSTATE_LIMIT_DEFINED | 2305 | #ifdef ACPI_CSTATE_LIMIT_DEFINED |
2329 | IPW_DEBUG_INFO(DRV_NAME ": Disabling C3 transitions.\n"); | 2306 | IPW_DEBUG_INFO(": Disabling C3 transitions.\n"); |
2330 | limit = acpi_get_cstate_limit(); | 2307 | limit = acpi_get_cstate_limit(); |
2331 | if (limit > 2) { | 2308 | if (limit > 2) { |
2332 | priv->cstate_limit = limit; | 2309 | priv->cstate_limit = limit; |
@@ -2346,9 +2323,9 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, | |||
2346 | 2323 | ||
2347 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) | 2324 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) |
2348 | break; | 2325 | break; |
2349 | } while (j--); | 2326 | } while (j--); |
2350 | 2327 | ||
2351 | match = ipw2100_match_buf(priv, (u8*)status, | 2328 | match = ipw2100_match_buf(priv, (u8 *) status, |
2352 | sizeof(struct ipw2100_status), | 2329 | sizeof(struct ipw2100_status), |
2353 | SEARCH_SNAPSHOT); | 2330 | SEARCH_SNAPSHOT); |
2354 | if (match < SEARCH_SUCCESS) | 2331 | if (match < SEARCH_SUCCESS) |
@@ -2360,7 +2337,7 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, | |||
2360 | IPW_DEBUG_INFO("%s: No DMA status match in " | 2337 | IPW_DEBUG_INFO("%s: No DMA status match in " |
2361 | "Firmware.\n", priv->net_dev->name); | 2338 | "Firmware.\n", priv->net_dev->name); |
2362 | 2339 | ||
2363 | printk_buf((u8*)priv->status_queue.drv, | 2340 | printk_buf((u8 *) priv->status_queue.drv, |
2364 | sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); | 2341 | sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); |
2365 | #endif | 2342 | #endif |
2366 | 2343 | ||
@@ -2392,26 +2369,26 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, | |||
2392 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); | 2369 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); |
2393 | return; | 2370 | return; |
2394 | } | 2371 | } |
2395 | 2372 | #ifdef CONFIG_IPW2100_MONITOR | |
2396 | if (unlikely(priv->ieee->iw_mode == IW_MODE_MONITOR && | 2373 | if (unlikely(priv->ieee->iw_mode == IW_MODE_MONITOR && |
2374 | priv->config & CFG_CRC_CHECK && | ||
2397 | status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { | 2375 | status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { |
2398 | IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); | 2376 | IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); |
2399 | priv->ieee->stats.rx_errors++; | 2377 | priv->ieee->stats.rx_errors++; |
2400 | return; | 2378 | return; |
2401 | } | 2379 | } |
2380 | #endif | ||
2402 | 2381 | ||
2403 | if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && | 2382 | if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && |
2404 | !(priv->status & STATUS_ASSOCIATED))) { | 2383 | !(priv->status & STATUS_ASSOCIATED))) { |
2405 | IPW_DEBUG_DROP("Dropping packet while not associated.\n"); | 2384 | IPW_DEBUG_DROP("Dropping packet while not associated.\n"); |
2406 | priv->wstats.discard.misc++; | 2385 | priv->wstats.discard.misc++; |
2407 | return; | 2386 | return; |
2408 | } | 2387 | } |
2409 | 2388 | ||
2410 | |||
2411 | pci_unmap_single(priv->pci_dev, | 2389 | pci_unmap_single(priv->pci_dev, |
2412 | packet->dma_addr, | 2390 | packet->dma_addr, |
2413 | sizeof(struct ipw2100_rx), | 2391 | sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); |
2414 | PCI_DMA_FROMDEVICE); | ||
2415 | 2392 | ||
2416 | skb_put(packet->skb, status->frame_size); | 2393 | skb_put(packet->skb, status->frame_size); |
2417 | 2394 | ||
@@ -2438,8 +2415,8 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, | |||
2438 | /* We need to allocate a new SKB and attach it to the RDB. */ | 2415 | /* We need to allocate a new SKB and attach it to the RDB. */ |
2439 | if (unlikely(ipw2100_alloc_skb(priv, packet))) { | 2416 | if (unlikely(ipw2100_alloc_skb(priv, packet))) { |
2440 | printk(KERN_WARNING DRV_NAME ": " | 2417 | printk(KERN_WARNING DRV_NAME ": " |
2441 | "%s: Unable to allocate SKB onto RBD ring - disabling " | 2418 | "%s: Unable to allocate SKB onto RBD ring - disabling " |
2442 | "adapter.\n", priv->net_dev->name); | 2419 | "adapter.\n", priv->net_dev->name); |
2443 | /* TODO: schedule adapter shutdown */ | 2420 | /* TODO: schedule adapter shutdown */ |
2444 | IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); | 2421 | IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); |
2445 | } | 2422 | } |
@@ -2534,11 +2511,11 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2534 | 2511 | ||
2535 | /* Sync the DMA for the STATUS buffer so CPU is sure to get | 2512 | /* Sync the DMA for the STATUS buffer so CPU is sure to get |
2536 | * the correct values */ | 2513 | * the correct values */ |
2537 | pci_dma_sync_single_for_cpu( | 2514 | pci_dma_sync_single_for_cpu(priv->pci_dev, |
2538 | priv->pci_dev, | 2515 | sq->nic + |
2539 | sq->nic + sizeof(struct ipw2100_status) * i, | 2516 | sizeof(struct ipw2100_status) * i, |
2540 | sizeof(struct ipw2100_status), | 2517 | sizeof(struct ipw2100_status), |
2541 | PCI_DMA_FROMDEVICE); | 2518 | PCI_DMA_FROMDEVICE); |
2542 | 2519 | ||
2543 | /* Sync the DMA for the RX buffer so CPU is sure to get | 2520 | /* Sync the DMA for the RX buffer so CPU is sure to get |
2544 | * the correct values */ | 2521 | * the correct values */ |
@@ -2552,8 +2529,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2552 | } | 2529 | } |
2553 | 2530 | ||
2554 | u = packet->rxp; | 2531 | u = packet->rxp; |
2555 | frame_type = sq->drv[i].status_fields & | 2532 | frame_type = sq->drv[i].status_fields & STATUS_TYPE_MASK; |
2556 | STATUS_TYPE_MASK; | ||
2557 | stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; | 2533 | stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; |
2558 | stats.len = sq->drv[i].frame_size; | 2534 | stats.len = sq->drv[i].frame_size; |
2559 | 2535 | ||
@@ -2562,16 +2538,14 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2562 | stats.mask |= IEEE80211_STATMASK_RSSI; | 2538 | stats.mask |= IEEE80211_STATMASK_RSSI; |
2563 | stats.freq = IEEE80211_24GHZ_BAND; | 2539 | stats.freq = IEEE80211_24GHZ_BAND; |
2564 | 2540 | ||
2565 | IPW_DEBUG_RX( | 2541 | IPW_DEBUG_RX("%s: '%s' frame type received (%d).\n", |
2566 | "%s: '%s' frame type received (%d).\n", | 2542 | priv->net_dev->name, frame_types[frame_type], |
2567 | priv->net_dev->name, frame_types[frame_type], | 2543 | stats.len); |
2568 | stats.len); | ||
2569 | 2544 | ||
2570 | switch (frame_type) { | 2545 | switch (frame_type) { |
2571 | case COMMAND_STATUS_VAL: | 2546 | case COMMAND_STATUS_VAL: |
2572 | /* Reset Rx watchdog */ | 2547 | /* Reset Rx watchdog */ |
2573 | isr_rx_complete_command( | 2548 | isr_rx_complete_command(priv, &u->rx_data.command); |
2574 | priv, &u->rx_data.command); | ||
2575 | break; | 2549 | break; |
2576 | 2550 | ||
2577 | case STATUS_CHANGE_VAL: | 2551 | case STATUS_CHANGE_VAL: |
@@ -2588,12 +2562,10 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2588 | #endif | 2562 | #endif |
2589 | if (stats.len < sizeof(u->rx_data.header)) | 2563 | if (stats.len < sizeof(u->rx_data.header)) |
2590 | break; | 2564 | break; |
2591 | switch (WLAN_FC_GET_TYPE(u->rx_data.header. | 2565 | switch (WLAN_FC_GET_TYPE(u->rx_data.header.frame_ctl)) { |
2592 | frame_ctl)) { | ||
2593 | case IEEE80211_FTYPE_MGMT: | 2566 | case IEEE80211_FTYPE_MGMT: |
2594 | ieee80211_rx_mgt(priv->ieee, | 2567 | ieee80211_rx_mgt(priv->ieee, |
2595 | &u->rx_data.header, | 2568 | &u->rx_data.header, &stats); |
2596 | &stats); | ||
2597 | break; | 2569 | break; |
2598 | 2570 | ||
2599 | case IEEE80211_FTYPE_CTL: | 2571 | case IEEE80211_FTYPE_CTL: |
@@ -2607,7 +2579,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2607 | break; | 2579 | break; |
2608 | } | 2580 | } |
2609 | 2581 | ||
2610 | increment: | 2582 | increment: |
2611 | /* clear status field associated with this RBD */ | 2583 | /* clear status field associated with this RBD */ |
2612 | rxq->drv[i].status.info.field = 0; | 2584 | rxq->drv[i].status.info.field = 0; |
2613 | 2585 | ||
@@ -2619,12 +2591,10 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2619 | rxq->next = (i ? i : rxq->entries) - 1; | 2591 | rxq->next = (i ? i : rxq->entries) - 1; |
2620 | 2592 | ||
2621 | write_register(priv->net_dev, | 2593 | write_register(priv->net_dev, |
2622 | IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, | 2594 | IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, rxq->next); |
2623 | rxq->next); | ||
2624 | } | 2595 | } |
2625 | } | 2596 | } |
2626 | 2597 | ||
2627 | |||
2628 | /* | 2598 | /* |
2629 | * __ipw2100_tx_process | 2599 | * __ipw2100_tx_process |
2630 | * | 2600 | * |
@@ -2667,7 +2637,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2667 | static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | 2637 | static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) |
2668 | { | 2638 | { |
2669 | struct ipw2100_bd_queue *txq = &priv->tx_queue; | 2639 | struct ipw2100_bd_queue *txq = &priv->tx_queue; |
2670 | struct ipw2100_bd *tbd; | 2640 | struct ipw2100_bd *tbd; |
2671 | struct list_head *element; | 2641 | struct list_head *element; |
2672 | struct ipw2100_tx_packet *packet; | 2642 | struct ipw2100_tx_packet *packet; |
2673 | int descriptors_used; | 2643 | int descriptors_used; |
@@ -2680,7 +2650,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2680 | element = priv->fw_pend_list.next; | 2650 | element = priv->fw_pend_list.next; |
2681 | 2651 | ||
2682 | packet = list_entry(element, struct ipw2100_tx_packet, list); | 2652 | packet = list_entry(element, struct ipw2100_tx_packet, list); |
2683 | tbd = &txq->drv[packet->index]; | 2653 | tbd = &txq->drv[packet->index]; |
2684 | 2654 | ||
2685 | /* Determine how many TBD entries must be finished... */ | 2655 | /* Determine how many TBD entries must be finished... */ |
2686 | switch (packet->type) { | 2656 | switch (packet->type) { |
@@ -2693,14 +2663,14 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2693 | case DATA: | 2663 | case DATA: |
2694 | /* DATA uses two slots; advance and loop position. */ | 2664 | /* DATA uses two slots; advance and loop position. */ |
2695 | descriptors_used = tbd->num_fragments; | 2665 | descriptors_used = tbd->num_fragments; |
2696 | frag_num = tbd->num_fragments - 1; | 2666 | frag_num = tbd->num_fragments - 1; |
2697 | e = txq->oldest + frag_num; | 2667 | e = txq->oldest + frag_num; |
2698 | e %= txq->entries; | 2668 | e %= txq->entries; |
2699 | break; | 2669 | break; |
2700 | 2670 | ||
2701 | default: | 2671 | default: |
2702 | printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", | 2672 | printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", |
2703 | priv->net_dev->name); | 2673 | priv->net_dev->name); |
2704 | return 0; | 2674 | return 0; |
2705 | } | 2675 | } |
2706 | 2676 | ||
@@ -2716,13 +2686,12 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2716 | printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", | 2686 | printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", |
2717 | priv->net_dev->name); | 2687 | priv->net_dev->name); |
2718 | 2688 | ||
2719 | /* | 2689 | /* |
2720 | * txq->next is the index of the last packet written txq->oldest is | 2690 | * txq->next is the index of the last packet written txq->oldest is |
2721 | * the index of the r is the index of the next packet to be read by | 2691 | * the index of the r is the index of the next packet to be read by |
2722 | * firmware | 2692 | * firmware |
2723 | */ | 2693 | */ |
2724 | 2694 | ||
2725 | |||
2726 | /* | 2695 | /* |
2727 | * Quick graphic to help you visualize the following | 2696 | * Quick graphic to help you visualize the following |
2728 | * if / else statement | 2697 | * if / else statement |
@@ -2750,23 +2719,20 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2750 | #ifdef CONFIG_IPW_DEBUG | 2719 | #ifdef CONFIG_IPW_DEBUG |
2751 | { | 2720 | { |
2752 | int i = txq->oldest; | 2721 | int i = txq->oldest; |
2753 | IPW_DEBUG_TX( | 2722 | IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, |
2754 | "TX%d V=%p P=%04X T=%04X L=%d\n", i, | 2723 | &txq->drv[i], |
2755 | &txq->drv[i], | 2724 | (u32) (txq->nic + i * sizeof(struct ipw2100_bd)), |
2756 | (u32)(txq->nic + i * sizeof(struct ipw2100_bd)), | 2725 | txq->drv[i].host_addr, txq->drv[i].buf_length); |
2757 | txq->drv[i].host_addr, | ||
2758 | txq->drv[i].buf_length); | ||
2759 | 2726 | ||
2760 | if (packet->type == DATA) { | 2727 | if (packet->type == DATA) { |
2761 | i = (i + 1) % txq->entries; | 2728 | i = (i + 1) % txq->entries; |
2762 | 2729 | ||
2763 | IPW_DEBUG_TX( | 2730 | IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, |
2764 | "TX%d V=%p P=%04X T=%04X L=%d\n", i, | 2731 | &txq->drv[i], |
2765 | &txq->drv[i], | 2732 | (u32) (txq->nic + i * |
2766 | (u32)(txq->nic + i * | 2733 | sizeof(struct ipw2100_bd)), |
2767 | sizeof(struct ipw2100_bd)), | 2734 | (u32) txq->drv[i].host_addr, |
2768 | (u32)txq->drv[i].host_addr, | 2735 | txq->drv[i].buf_length); |
2769 | txq->drv[i].buf_length); | ||
2770 | } | 2736 | } |
2771 | } | 2737 | } |
2772 | #endif | 2738 | #endif |
@@ -2780,23 +2746,18 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2780 | priv->net_dev->name, txq->oldest, packet->index); | 2746 | priv->net_dev->name, txq->oldest, packet->index); |
2781 | 2747 | ||
2782 | /* DATA packet; we have to unmap and free the SKB */ | 2748 | /* DATA packet; we have to unmap and free the SKB */ |
2783 | priv->ieee->stats.tx_packets++; | ||
2784 | for (i = 0; i < frag_num; i++) { | 2749 | for (i = 0; i < frag_num; i++) { |
2785 | tbd = &txq->drv[(packet->index + 1 + i) % | 2750 | tbd = &txq->drv[(packet->index + 1 + i) % txq->entries]; |
2786 | txq->entries]; | ||
2787 | 2751 | ||
2788 | IPW_DEBUG_TX( | 2752 | IPW_DEBUG_TX("TX%d P=%08x L=%d\n", |
2789 | "TX%d P=%08x L=%d\n", | 2753 | (packet->index + 1 + i) % txq->entries, |
2790 | (packet->index + 1 + i) % txq->entries, | 2754 | tbd->host_addr, tbd->buf_length); |
2791 | tbd->host_addr, tbd->buf_length); | ||
2792 | 2755 | ||
2793 | pci_unmap_single(priv->pci_dev, | 2756 | pci_unmap_single(priv->pci_dev, |
2794 | tbd->host_addr, | 2757 | tbd->host_addr, |
2795 | tbd->buf_length, | 2758 | tbd->buf_length, PCI_DMA_TODEVICE); |
2796 | PCI_DMA_TODEVICE); | ||
2797 | } | 2759 | } |
2798 | 2760 | ||
2799 | priv->ieee->stats.tx_bytes += packet->info.d_struct.txb->payload_size; | ||
2800 | ieee80211_txb_free(packet->info.d_struct.txb); | 2761 | ieee80211_txb_free(packet->info.d_struct.txb); |
2801 | packet->info.d_struct.txb = NULL; | 2762 | packet->info.d_struct.txb = NULL; |
2802 | 2763 | ||
@@ -2805,13 +2766,8 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2805 | 2766 | ||
2806 | /* We have a free slot in the Tx queue, so wake up the | 2767 | /* We have a free slot in the Tx queue, so wake up the |
2807 | * transmit layer if it is stopped. */ | 2768 | * transmit layer if it is stopped. */ |
2808 | if (priv->status & STATUS_ASSOCIATED && | 2769 | if (priv->status & STATUS_ASSOCIATED) |
2809 | netif_queue_stopped(priv->net_dev)) { | ||
2810 | IPW_DEBUG_INFO(KERN_INFO | ||
2811 | "%s: Waking net queue.\n", | ||
2812 | priv->net_dev->name); | ||
2813 | netif_wake_queue(priv->net_dev); | 2770 | netif_wake_queue(priv->net_dev); |
2814 | } | ||
2815 | 2771 | ||
2816 | /* A packet was processed by the hardware, so update the | 2772 | /* A packet was processed by the hardware, so update the |
2817 | * watchdog */ | 2773 | * watchdog */ |
@@ -2829,11 +2785,12 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2829 | #ifdef CONFIG_IPW_DEBUG | 2785 | #ifdef CONFIG_IPW_DEBUG |
2830 | if (packet->info.c_struct.cmd->host_command_reg < | 2786 | if (packet->info.c_struct.cmd->host_command_reg < |
2831 | sizeof(command_types) / sizeof(*command_types)) | 2787 | sizeof(command_types) / sizeof(*command_types)) |
2832 | IPW_DEBUG_TX( | 2788 | IPW_DEBUG_TX("Command '%s (%d)' processed: %d.\n", |
2833 | "Command '%s (%d)' processed: %d.\n", | 2789 | command_types[packet->info.c_struct.cmd-> |
2834 | command_types[packet->info.c_struct.cmd->host_command_reg], | 2790 | host_command_reg], |
2835 | packet->info.c_struct.cmd->host_command_reg, | 2791 | packet->info.c_struct.cmd-> |
2836 | packet->info.c_struct.cmd->cmd_status_reg); | 2792 | host_command_reg, |
2793 | packet->info.c_struct.cmd->cmd_status_reg); | ||
2837 | #endif | 2794 | #endif |
2838 | 2795 | ||
2839 | list_add_tail(element, &priv->msg_free_list); | 2796 | list_add_tail(element, &priv->msg_free_list); |
@@ -2848,17 +2805,17 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2848 | SET_STAT(&priv->txq_stat, txq->available); | 2805 | SET_STAT(&priv->txq_stat, txq->available); |
2849 | 2806 | ||
2850 | IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", | 2807 | IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", |
2851 | jiffies - packet->jiffy_start); | 2808 | jiffies - packet->jiffy_start); |
2852 | 2809 | ||
2853 | return (!list_empty(&priv->fw_pend_list)); | 2810 | return (!list_empty(&priv->fw_pend_list)); |
2854 | } | 2811 | } |
2855 | 2812 | ||
2856 | |||
2857 | static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) | 2813 | static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) |
2858 | { | 2814 | { |
2859 | int i = 0; | 2815 | int i = 0; |
2860 | 2816 | ||
2861 | while (__ipw2100_tx_process(priv) && i < 200) i++; | 2817 | while (__ipw2100_tx_process(priv) && i < 200) |
2818 | i++; | ||
2862 | 2819 | ||
2863 | if (i == 200) { | 2820 | if (i == 200) { |
2864 | printk(KERN_WARNING DRV_NAME ": " | 2821 | printk(KERN_WARNING DRV_NAME ": " |
@@ -2867,7 +2824,6 @@ static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) | |||
2867 | } | 2824 | } |
2868 | } | 2825 | } |
2869 | 2826 | ||
2870 | |||
2871 | static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) | 2827 | static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) |
2872 | { | 2828 | { |
2873 | struct list_head *element; | 2829 | struct list_head *element; |
@@ -2892,13 +2848,12 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) | |||
2892 | list_del(element); | 2848 | list_del(element); |
2893 | DEC_STAT(&priv->msg_pend_stat); | 2849 | DEC_STAT(&priv->msg_pend_stat); |
2894 | 2850 | ||
2895 | packet = list_entry(element, | 2851 | packet = list_entry(element, struct ipw2100_tx_packet, list); |
2896 | struct ipw2100_tx_packet, list); | ||
2897 | 2852 | ||
2898 | IPW_DEBUG_TX("using TBD at virt=%p, phys=%p\n", | 2853 | IPW_DEBUG_TX("using TBD at virt=%p, phys=%p\n", |
2899 | &txq->drv[txq->next], | 2854 | &txq->drv[txq->next], |
2900 | (void*)(txq->nic + txq->next * | 2855 | (void *)(txq->nic + txq->next * |
2901 | sizeof(struct ipw2100_bd))); | 2856 | sizeof(struct ipw2100_bd))); |
2902 | 2857 | ||
2903 | packet->index = txq->next; | 2858 | packet->index = txq->next; |
2904 | 2859 | ||
@@ -2911,8 +2866,8 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) | |||
2911 | * with f/w debug version */ | 2866 | * with f/w debug version */ |
2912 | tbd->num_fragments = 1; | 2867 | tbd->num_fragments = 1; |
2913 | tbd->status.info.field = | 2868 | tbd->status.info.field = |
2914 | IPW_BD_STATUS_TX_FRAME_COMMAND | | 2869 | IPW_BD_STATUS_TX_FRAME_COMMAND | |
2915 | IPW_BD_STATUS_TX_INTERRUPT_ENABLE; | 2870 | IPW_BD_STATUS_TX_INTERRUPT_ENABLE; |
2916 | 2871 | ||
2917 | /* update TBD queue counters */ | 2872 | /* update TBD queue counters */ |
2918 | txq->next++; | 2873 | txq->next++; |
@@ -2934,7 +2889,6 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) | |||
2934 | } | 2889 | } |
2935 | } | 2890 | } |
2936 | 2891 | ||
2937 | |||
2938 | /* | 2892 | /* |
2939 | * ipw2100_tx_send_data | 2893 | * ipw2100_tx_send_data |
2940 | * | 2894 | * |
@@ -2946,7 +2900,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
2946 | struct ipw2100_bd_queue *txq = &priv->tx_queue; | 2900 | struct ipw2100_bd_queue *txq = &priv->tx_queue; |
2947 | struct ipw2100_bd *tbd; | 2901 | struct ipw2100_bd *tbd; |
2948 | int next = txq->next; | 2902 | int next = txq->next; |
2949 | int i = 0; | 2903 | int i = 0; |
2950 | struct ipw2100_data_header *ipw_hdr; | 2904 | struct ipw2100_data_header *ipw_hdr; |
2951 | struct ieee80211_hdr_3addr *hdr; | 2905 | struct ieee80211_hdr_3addr *hdr; |
2952 | 2906 | ||
@@ -2958,20 +2912,18 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
2958 | * maintained between the r and w indexes | 2912 | * maintained between the r and w indexes |
2959 | */ | 2913 | */ |
2960 | element = priv->tx_pend_list.next; | 2914 | element = priv->tx_pend_list.next; |
2961 | packet = list_entry(element, struct ipw2100_tx_packet, list); | 2915 | packet = list_entry(element, struct ipw2100_tx_packet, list); |
2962 | 2916 | ||
2963 | if (unlikely(1 + packet->info.d_struct.txb->nr_frags > | 2917 | if (unlikely(1 + packet->info.d_struct.txb->nr_frags > |
2964 | IPW_MAX_BDS)) { | 2918 | IPW_MAX_BDS)) { |
2965 | /* TODO: Support merging buffers if more than | 2919 | /* TODO: Support merging buffers if more than |
2966 | * IPW_MAX_BDS are used */ | 2920 | * IPW_MAX_BDS are used */ |
2967 | IPW_DEBUG_INFO( | 2921 | IPW_DEBUG_INFO("%s: Maximum BD theshold exceeded. " |
2968 | "%s: Maximum BD theshold exceeded. " | 2922 | "Increase fragmentation level.\n", |
2969 | "Increase fragmentation level.\n", | 2923 | priv->net_dev->name); |
2970 | priv->net_dev->name); | ||
2971 | } | 2924 | } |
2972 | 2925 | ||
2973 | if (txq->available <= 3 + | 2926 | if (txq->available <= 3 + packet->info.d_struct.txb->nr_frags) { |
2974 | packet->info.d_struct.txb->nr_frags) { | ||
2975 | IPW_DEBUG_TX("no room in tx_queue\n"); | 2927 | IPW_DEBUG_TX("no room in tx_queue\n"); |
2976 | break; | 2928 | break; |
2977 | } | 2929 | } |
@@ -2985,7 +2937,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
2985 | 2937 | ||
2986 | ipw_hdr = packet->info.d_struct.data; | 2938 | ipw_hdr = packet->info.d_struct.data; |
2987 | hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb-> | 2939 | hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb-> |
2988 | fragments[0]->data; | 2940 | fragments[0]->data; |
2989 | 2941 | ||
2990 | if (priv->ieee->iw_mode == IW_MODE_INFRA) { | 2942 | if (priv->ieee->iw_mode == IW_MODE_INFRA) { |
2991 | /* To DS: Addr1 = BSSID, Addr2 = SA, | 2943 | /* To DS: Addr1 = BSSID, Addr2 = SA, |
@@ -3007,7 +2959,8 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
3007 | ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; | 2959 | ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; |
3008 | if (packet->info.d_struct.txb->nr_frags > 1) | 2960 | if (packet->info.d_struct.txb->nr_frags > 1) |
3009 | ipw_hdr->fragment_size = | 2961 | ipw_hdr->fragment_size = |
3010 | packet->info.d_struct.txb->frag_size - IEEE80211_3ADDR_LEN; | 2962 | packet->info.d_struct.txb->frag_size - |
2963 | IEEE80211_3ADDR_LEN; | ||
3011 | else | 2964 | else |
3012 | ipw_hdr->fragment_size = 0; | 2965 | ipw_hdr->fragment_size = 0; |
3013 | 2966 | ||
@@ -3015,54 +2968,53 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
3015 | tbd->buf_length = sizeof(struct ipw2100_data_header); | 2968 | tbd->buf_length = sizeof(struct ipw2100_data_header); |
3016 | tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; | 2969 | tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; |
3017 | tbd->status.info.field = | 2970 | tbd->status.info.field = |
3018 | IPW_BD_STATUS_TX_FRAME_802_3 | | 2971 | IPW_BD_STATUS_TX_FRAME_802_3 | |
3019 | IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; | 2972 | IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; |
3020 | txq->next++; | 2973 | txq->next++; |
3021 | txq->next %= txq->entries; | 2974 | txq->next %= txq->entries; |
3022 | 2975 | ||
3023 | IPW_DEBUG_TX( | 2976 | IPW_DEBUG_TX("data header tbd TX%d P=%08x L=%d\n", |
3024 | "data header tbd TX%d P=%08x L=%d\n", | 2977 | packet->index, tbd->host_addr, tbd->buf_length); |
3025 | packet->index, tbd->host_addr, | ||
3026 | tbd->buf_length); | ||
3027 | #ifdef CONFIG_IPW_DEBUG | 2978 | #ifdef CONFIG_IPW_DEBUG |
3028 | if (packet->info.d_struct.txb->nr_frags > 1) | 2979 | if (packet->info.d_struct.txb->nr_frags > 1) |
3029 | IPW_DEBUG_FRAG("fragment Tx: %d frames\n", | 2980 | IPW_DEBUG_FRAG("fragment Tx: %d frames\n", |
3030 | packet->info.d_struct.txb->nr_frags); | 2981 | packet->info.d_struct.txb->nr_frags); |
3031 | #endif | 2982 | #endif |
3032 | 2983 | ||
3033 | for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { | 2984 | for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { |
3034 | tbd = &txq->drv[txq->next]; | 2985 | tbd = &txq->drv[txq->next]; |
3035 | if (i == packet->info.d_struct.txb->nr_frags - 1) | 2986 | if (i == packet->info.d_struct.txb->nr_frags - 1) |
3036 | tbd->status.info.field = | 2987 | tbd->status.info.field = |
3037 | IPW_BD_STATUS_TX_FRAME_802_3 | | 2988 | IPW_BD_STATUS_TX_FRAME_802_3 | |
3038 | IPW_BD_STATUS_TX_INTERRUPT_ENABLE; | 2989 | IPW_BD_STATUS_TX_INTERRUPT_ENABLE; |
3039 | else | 2990 | else |
3040 | tbd->status.info.field = | 2991 | tbd->status.info.field = |
3041 | IPW_BD_STATUS_TX_FRAME_802_3 | | 2992 | IPW_BD_STATUS_TX_FRAME_802_3 | |
3042 | IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; | 2993 | IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; |
3043 | 2994 | ||
3044 | tbd->buf_length = packet->info.d_struct.txb-> | 2995 | tbd->buf_length = packet->info.d_struct.txb-> |
3045 | fragments[i]->len - IEEE80211_3ADDR_LEN; | 2996 | fragments[i]->len - IEEE80211_3ADDR_LEN; |
3046 | 2997 | ||
3047 | tbd->host_addr = pci_map_single( | 2998 | tbd->host_addr = pci_map_single(priv->pci_dev, |
3048 | priv->pci_dev, | 2999 | packet->info.d_struct. |
3049 | packet->info.d_struct.txb->fragments[i]->data + | 3000 | txb->fragments[i]-> |
3050 | IEEE80211_3ADDR_LEN, | 3001 | data + |
3051 | tbd->buf_length, | 3002 | IEEE80211_3ADDR_LEN, |
3052 | PCI_DMA_TODEVICE); | 3003 | tbd->buf_length, |
3004 | PCI_DMA_TODEVICE); | ||
3053 | 3005 | ||
3054 | IPW_DEBUG_TX( | 3006 | IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n", |
3055 | "data frag tbd TX%d P=%08x L=%d\n", | 3007 | txq->next, tbd->host_addr, |
3056 | txq->next, tbd->host_addr, tbd->buf_length); | 3008 | tbd->buf_length); |
3057 | 3009 | ||
3058 | pci_dma_sync_single_for_device( | 3010 | pci_dma_sync_single_for_device(priv->pci_dev, |
3059 | priv->pci_dev, tbd->host_addr, | 3011 | tbd->host_addr, |
3060 | tbd->buf_length, | 3012 | tbd->buf_length, |
3061 | PCI_DMA_TODEVICE); | 3013 | PCI_DMA_TODEVICE); |
3062 | 3014 | ||
3063 | txq->next++; | 3015 | txq->next++; |
3064 | txq->next %= txq->entries; | 3016 | txq->next %= txq->entries; |
3065 | } | 3017 | } |
3066 | 3018 | ||
3067 | txq->available -= 1 + packet->info.d_struct.txb->nr_frags; | 3019 | txq->available -= 1 + packet->info.d_struct.txb->nr_frags; |
3068 | SET_STAT(&priv->txq_stat, txq->available); | 3020 | SET_STAT(&priv->txq_stat, txq->available); |
@@ -3078,7 +3030,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
3078 | IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, | 3030 | IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, |
3079 | txq->next); | 3031 | txq->next); |
3080 | } | 3032 | } |
3081 | return; | 3033 | return; |
3082 | } | 3034 | } |
3083 | 3035 | ||
3084 | static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | 3036 | static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) |
@@ -3106,11 +3058,9 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3106 | 3058 | ||
3107 | if (inta & IPW2100_INTA_FATAL_ERROR) { | 3059 | if (inta & IPW2100_INTA_FATAL_ERROR) { |
3108 | printk(KERN_WARNING DRV_NAME | 3060 | printk(KERN_WARNING DRV_NAME |
3109 | ": Fatal interrupt. Scheduling firmware restart.\n"); | 3061 | ": Fatal interrupt. Scheduling firmware restart.\n"); |
3110 | priv->inta_other++; | 3062 | priv->inta_other++; |
3111 | write_register( | 3063 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_FATAL_ERROR); |
3112 | dev, IPW_REG_INTA, | ||
3113 | IPW2100_INTA_FATAL_ERROR); | ||
3114 | 3064 | ||
3115 | read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); | 3065 | read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); |
3116 | IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", | 3066 | IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", |
@@ -3125,11 +3075,10 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3125 | } | 3075 | } |
3126 | 3076 | ||
3127 | if (inta & IPW2100_INTA_PARITY_ERROR) { | 3077 | if (inta & IPW2100_INTA_PARITY_ERROR) { |
3128 | printk(KERN_ERR DRV_NAME ": ***** PARITY ERROR INTERRUPT !!!! \n"); | 3078 | printk(KERN_ERR DRV_NAME |
3079 | ": ***** PARITY ERROR INTERRUPT !!!! \n"); | ||
3129 | priv->inta_other++; | 3080 | priv->inta_other++; |
3130 | write_register( | 3081 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_PARITY_ERROR); |
3131 | dev, IPW_REG_INTA, | ||
3132 | IPW2100_INTA_PARITY_ERROR); | ||
3133 | } | 3082 | } |
3134 | 3083 | ||
3135 | if (inta & IPW2100_INTA_RX_TRANSFER) { | 3084 | if (inta & IPW2100_INTA_RX_TRANSFER) { |
@@ -3137,9 +3086,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3137 | 3086 | ||
3138 | priv->rx_interrupts++; | 3087 | priv->rx_interrupts++; |
3139 | 3088 | ||
3140 | write_register( | 3089 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_RX_TRANSFER); |
3141 | dev, IPW_REG_INTA, | ||
3142 | IPW2100_INTA_RX_TRANSFER); | ||
3143 | 3090 | ||
3144 | __ipw2100_rx_process(priv); | 3091 | __ipw2100_rx_process(priv); |
3145 | __ipw2100_tx_complete(priv); | 3092 | __ipw2100_tx_complete(priv); |
@@ -3150,8 +3097,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3150 | 3097 | ||
3151 | priv->tx_interrupts++; | 3098 | priv->tx_interrupts++; |
3152 | 3099 | ||
3153 | write_register(dev, IPW_REG_INTA, | 3100 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_TRANSFER); |
3154 | IPW2100_INTA_TX_TRANSFER); | ||
3155 | 3101 | ||
3156 | __ipw2100_tx_complete(priv); | 3102 | __ipw2100_tx_complete(priv); |
3157 | ipw2100_tx_send_commands(priv); | 3103 | ipw2100_tx_send_commands(priv); |
@@ -3161,9 +3107,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3161 | if (inta & IPW2100_INTA_TX_COMPLETE) { | 3107 | if (inta & IPW2100_INTA_TX_COMPLETE) { |
3162 | IPW_DEBUG_ISR("TX complete\n"); | 3108 | IPW_DEBUG_ISR("TX complete\n"); |
3163 | priv->inta_other++; | 3109 | priv->inta_other++; |
3164 | write_register( | 3110 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_COMPLETE); |
3165 | dev, IPW_REG_INTA, | ||
3166 | IPW2100_INTA_TX_COMPLETE); | ||
3167 | 3111 | ||
3168 | __ipw2100_tx_complete(priv); | 3112 | __ipw2100_tx_complete(priv); |
3169 | } | 3113 | } |
@@ -3171,9 +3115,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3171 | if (inta & IPW2100_INTA_EVENT_INTERRUPT) { | 3115 | if (inta & IPW2100_INTA_EVENT_INTERRUPT) { |
3172 | /* ipw2100_handle_event(dev); */ | 3116 | /* ipw2100_handle_event(dev); */ |
3173 | priv->inta_other++; | 3117 | priv->inta_other++; |
3174 | write_register( | 3118 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_EVENT_INTERRUPT); |
3175 | dev, IPW_REG_INTA, | ||
3176 | IPW2100_INTA_EVENT_INTERRUPT); | ||
3177 | } | 3119 | } |
3178 | 3120 | ||
3179 | if (inta & IPW2100_INTA_FW_INIT_DONE) { | 3121 | if (inta & IPW2100_INTA_FW_INIT_DONE) { |
@@ -3183,30 +3125,25 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3183 | read_register(dev, IPW_REG_INTA, &tmp); | 3125 | read_register(dev, IPW_REG_INTA, &tmp); |
3184 | if (tmp & (IPW2100_INTA_FATAL_ERROR | | 3126 | if (tmp & (IPW2100_INTA_FATAL_ERROR | |
3185 | IPW2100_INTA_PARITY_ERROR)) { | 3127 | IPW2100_INTA_PARITY_ERROR)) { |
3186 | write_register( | 3128 | write_register(dev, IPW_REG_INTA, |
3187 | dev, IPW_REG_INTA, | 3129 | IPW2100_INTA_FATAL_ERROR | |
3188 | IPW2100_INTA_FATAL_ERROR | | 3130 | IPW2100_INTA_PARITY_ERROR); |
3189 | IPW2100_INTA_PARITY_ERROR); | ||
3190 | } | 3131 | } |
3191 | 3132 | ||
3192 | write_register(dev, IPW_REG_INTA, | 3133 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_FW_INIT_DONE); |
3193 | IPW2100_INTA_FW_INIT_DONE); | ||
3194 | } | 3134 | } |
3195 | 3135 | ||
3196 | if (inta & IPW2100_INTA_STATUS_CHANGE) { | 3136 | if (inta & IPW2100_INTA_STATUS_CHANGE) { |
3197 | IPW_DEBUG_ISR("Status change interrupt\n"); | 3137 | IPW_DEBUG_ISR("Status change interrupt\n"); |
3198 | priv->inta_other++; | 3138 | priv->inta_other++; |
3199 | write_register( | 3139 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_STATUS_CHANGE); |
3200 | dev, IPW_REG_INTA, | ||
3201 | IPW2100_INTA_STATUS_CHANGE); | ||
3202 | } | 3140 | } |
3203 | 3141 | ||
3204 | if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { | 3142 | if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { |
3205 | IPW_DEBUG_ISR("slave host mode interrupt\n"); | 3143 | IPW_DEBUG_ISR("slave host mode interrupt\n"); |
3206 | priv->inta_other++; | 3144 | priv->inta_other++; |
3207 | write_register( | 3145 | write_register(dev, IPW_REG_INTA, |
3208 | dev, IPW_REG_INTA, | 3146 | IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); |
3209 | IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); | ||
3210 | } | 3147 | } |
3211 | 3148 | ||
3212 | priv->in_isr--; | 3149 | priv->in_isr--; |
@@ -3217,9 +3154,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3217 | IPW_DEBUG_ISR("exit\n"); | 3154 | IPW_DEBUG_ISR("exit\n"); |
3218 | } | 3155 | } |
3219 | 3156 | ||
3220 | 3157 | static irqreturn_t ipw2100_interrupt(int irq, void *data, struct pt_regs *regs) | |
3221 | static irqreturn_t ipw2100_interrupt(int irq, void *data, | ||
3222 | struct pt_regs *regs) | ||
3223 | { | 3158 | { |
3224 | struct ipw2100_priv *priv = data; | 3159 | struct ipw2100_priv *priv = data; |
3225 | u32 inta, inta_mask; | 3160 | u32 inta, inta_mask; |
@@ -3227,7 +3162,7 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data, | |||
3227 | if (!data) | 3162 | if (!data) |
3228 | return IRQ_NONE; | 3163 | return IRQ_NONE; |
3229 | 3164 | ||
3230 | spin_lock(&priv->low_lock); | 3165 | spin_lock(&priv->low_lock); |
3231 | 3166 | ||
3232 | /* We check to see if we should be ignoring interrupts before | 3167 | /* We check to see if we should be ignoring interrupts before |
3233 | * we touch the hardware. During ucode load if we try and handle | 3168 | * we touch the hardware. During ucode load if we try and handle |
@@ -3261,10 +3196,10 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data, | |||
3261 | ipw2100_disable_interrupts(priv); | 3196 | ipw2100_disable_interrupts(priv); |
3262 | 3197 | ||
3263 | tasklet_schedule(&priv->irq_tasklet); | 3198 | tasklet_schedule(&priv->irq_tasklet); |
3264 | spin_unlock(&priv->low_lock); | 3199 | spin_unlock(&priv->low_lock); |
3265 | 3200 | ||
3266 | return IRQ_HANDLED; | 3201 | return IRQ_HANDLED; |
3267 | none: | 3202 | none: |
3268 | spin_unlock(&priv->low_lock); | 3203 | spin_unlock(&priv->low_lock); |
3269 | return IRQ_NONE; | 3204 | return IRQ_NONE; |
3270 | } | 3205 | } |
@@ -3294,10 +3229,8 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev, | |||
3294 | 3229 | ||
3295 | packet->info.d_struct.txb = txb; | 3230 | packet->info.d_struct.txb = txb; |
3296 | 3231 | ||
3297 | IPW_DEBUG_TX("Sending fragment (%d bytes):\n", | 3232 | IPW_DEBUG_TX("Sending fragment (%d bytes):\n", txb->fragments[0]->len); |
3298 | txb->fragments[0]->len); | 3233 | printk_buf(IPW_DL_TX, txb->fragments[0]->data, txb->fragments[0]->len); |
3299 | printk_buf(IPW_DL_TX, txb->fragments[0]->data, | ||
3300 | txb->fragments[0]->len); | ||
3301 | 3234 | ||
3302 | packet->jiffy_start = jiffies; | 3235 | packet->jiffy_start = jiffies; |
3303 | 3236 | ||
@@ -3312,22 +3245,23 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev, | |||
3312 | spin_unlock_irqrestore(&priv->low_lock, flags); | 3245 | spin_unlock_irqrestore(&priv->low_lock, flags); |
3313 | return 0; | 3246 | return 0; |
3314 | 3247 | ||
3315 | fail_unlock: | 3248 | fail_unlock: |
3316 | netif_stop_queue(dev); | 3249 | netif_stop_queue(dev); |
3317 | spin_unlock_irqrestore(&priv->low_lock, flags); | 3250 | spin_unlock_irqrestore(&priv->low_lock, flags); |
3318 | return 1; | 3251 | return 1; |
3319 | } | 3252 | } |
3320 | 3253 | ||
3321 | |||
3322 | static int ipw2100_msg_allocate(struct ipw2100_priv *priv) | 3254 | static int ipw2100_msg_allocate(struct ipw2100_priv *priv) |
3323 | { | 3255 | { |
3324 | int i, j, err = -EINVAL; | 3256 | int i, j, err = -EINVAL; |
3325 | void *v; | 3257 | void *v; |
3326 | dma_addr_t p; | 3258 | dma_addr_t p; |
3327 | 3259 | ||
3328 | priv->msg_buffers = (struct ipw2100_tx_packet *)kmalloc( | 3260 | priv->msg_buffers = |
3329 | IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet), | 3261 | (struct ipw2100_tx_packet *)kmalloc(IPW_COMMAND_POOL_SIZE * |
3330 | GFP_KERNEL); | 3262 | sizeof(struct |
3263 | ipw2100_tx_packet), | ||
3264 | GFP_KERNEL); | ||
3331 | if (!priv->msg_buffers) { | 3265 | if (!priv->msg_buffers) { |
3332 | printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg " | 3266 | printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg " |
3333 | "buffers.\n", priv->net_dev->name); | 3267 | "buffers.\n", priv->net_dev->name); |
@@ -3335,15 +3269,12 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) | |||
3335 | } | 3269 | } |
3336 | 3270 | ||
3337 | for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { | 3271 | for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { |
3338 | v = pci_alloc_consistent( | 3272 | v = pci_alloc_consistent(priv->pci_dev, |
3339 | priv->pci_dev, | 3273 | sizeof(struct ipw2100_cmd_header), &p); |
3340 | sizeof(struct ipw2100_cmd_header), | ||
3341 | &p); | ||
3342 | if (!v) { | 3274 | if (!v) { |
3343 | printk(KERN_ERR DRV_NAME ": " | 3275 | printk(KERN_ERR DRV_NAME ": " |
3344 | "%s: PCI alloc failed for msg " | 3276 | "%s: PCI alloc failed for msg " |
3345 | "buffers.\n", | 3277 | "buffers.\n", priv->net_dev->name); |
3346 | priv->net_dev->name); | ||
3347 | err = -ENOMEM; | 3278 | err = -ENOMEM; |
3348 | break; | 3279 | break; |
3349 | } | 3280 | } |
@@ -3352,7 +3283,7 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) | |||
3352 | 3283 | ||
3353 | priv->msg_buffers[i].type = COMMAND; | 3284 | priv->msg_buffers[i].type = COMMAND; |
3354 | priv->msg_buffers[i].info.c_struct.cmd = | 3285 | priv->msg_buffers[i].info.c_struct.cmd = |
3355 | (struct ipw2100_cmd_header*)v; | 3286 | (struct ipw2100_cmd_header *)v; |
3356 | priv->msg_buffers[i].info.c_struct.cmd_phys = p; | 3287 | priv->msg_buffers[i].info.c_struct.cmd_phys = p; |
3357 | } | 3288 | } |
3358 | 3289 | ||
@@ -3360,11 +3291,11 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) | |||
3360 | return 0; | 3291 | return 0; |
3361 | 3292 | ||
3362 | for (j = 0; j < i; j++) { | 3293 | for (j = 0; j < i; j++) { |
3363 | pci_free_consistent( | 3294 | pci_free_consistent(priv->pci_dev, |
3364 | priv->pci_dev, | 3295 | sizeof(struct ipw2100_cmd_header), |
3365 | sizeof(struct ipw2100_cmd_header), | 3296 | priv->msg_buffers[j].info.c_struct.cmd, |
3366 | priv->msg_buffers[j].info.c_struct.cmd, | 3297 | priv->msg_buffers[j].info.c_struct. |
3367 | priv->msg_buffers[j].info.c_struct.cmd_phys); | 3298 | cmd_phys); |
3368 | } | 3299 | } |
3369 | 3300 | ||
3370 | kfree(priv->msg_buffers); | 3301 | kfree(priv->msg_buffers); |
@@ -3398,7 +3329,8 @@ static void ipw2100_msg_free(struct ipw2100_priv *priv) | |||
3398 | pci_free_consistent(priv->pci_dev, | 3329 | pci_free_consistent(priv->pci_dev, |
3399 | sizeof(struct ipw2100_cmd_header), | 3330 | sizeof(struct ipw2100_cmd_header), |
3400 | priv->msg_buffers[i].info.c_struct.cmd, | 3331 | priv->msg_buffers[i].info.c_struct.cmd, |
3401 | priv->msg_buffers[i].info.c_struct.cmd_phys); | 3332 | priv->msg_buffers[i].info.c_struct. |
3333 | cmd_phys); | ||
3402 | } | 3334 | } |
3403 | 3335 | ||
3404 | kfree(priv->msg_buffers); | 3336 | kfree(priv->msg_buffers); |
@@ -3424,6 +3356,7 @@ static ssize_t show_pci(struct device *d, struct device_attribute *attr, | |||
3424 | 3356 | ||
3425 | return out - buf; | 3357 | return out - buf; |
3426 | } | 3358 | } |
3359 | |||
3427 | static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); | 3360 | static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); |
3428 | 3361 | ||
3429 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | 3362 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, |
@@ -3432,209 +3365,269 @@ static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | |||
3432 | struct ipw2100_priv *p = d->driver_data; | 3365 | struct ipw2100_priv *p = d->driver_data; |
3433 | return sprintf(buf, "0x%08x\n", (int)p->config); | 3366 | return sprintf(buf, "0x%08x\n", (int)p->config); |
3434 | } | 3367 | } |
3368 | |||
3435 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); | 3369 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); |
3436 | 3370 | ||
3437 | static ssize_t show_status(struct device *d, struct device_attribute *attr, | 3371 | static ssize_t show_status(struct device *d, struct device_attribute *attr, |
3438 | char *buf) | 3372 | char *buf) |
3439 | { | 3373 | { |
3440 | struct ipw2100_priv *p = d->driver_data; | 3374 | struct ipw2100_priv *p = d->driver_data; |
3441 | return sprintf(buf, "0x%08x\n", (int)p->status); | 3375 | return sprintf(buf, "0x%08x\n", (int)p->status); |
3442 | } | 3376 | } |
3377 | |||
3443 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); | 3378 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); |
3444 | 3379 | ||
3445 | static ssize_t show_capability(struct device *d, struct device_attribute *attr, | 3380 | static ssize_t show_capability(struct device *d, struct device_attribute *attr, |
3446 | char *buf) | 3381 | char *buf) |
3447 | { | 3382 | { |
3448 | struct ipw2100_priv *p = d->driver_data; | 3383 | struct ipw2100_priv *p = d->driver_data; |
3449 | return sprintf(buf, "0x%08x\n", (int)p->capability); | 3384 | return sprintf(buf, "0x%08x\n", (int)p->capability); |
3450 | } | 3385 | } |
3451 | static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); | ||
3452 | 3386 | ||
3387 | static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); | ||
3453 | 3388 | ||
3454 | #define IPW2100_REG(x) { IPW_ ##x, #x } | 3389 | #define IPW2100_REG(x) { IPW_ ##x, #x } |
3455 | static const struct { | 3390 | static const struct { |
3456 | u32 addr; | 3391 | u32 addr; |
3457 | const char *name; | 3392 | const char *name; |
3458 | } hw_data[] = { | 3393 | } hw_data[] = { |
3459 | IPW2100_REG(REG_GP_CNTRL), | 3394 | IPW2100_REG(REG_GP_CNTRL), |
3460 | IPW2100_REG(REG_GPIO), | 3395 | IPW2100_REG(REG_GPIO), |
3461 | IPW2100_REG(REG_INTA), | 3396 | IPW2100_REG(REG_INTA), |
3462 | IPW2100_REG(REG_INTA_MASK), | 3397 | IPW2100_REG(REG_INTA_MASK), IPW2100_REG(REG_RESET_REG),}; |
3463 | IPW2100_REG(REG_RESET_REG), | ||
3464 | }; | ||
3465 | #define IPW2100_NIC(x, s) { x, #x, s } | 3398 | #define IPW2100_NIC(x, s) { x, #x, s } |
3466 | static const struct { | 3399 | static const struct { |
3467 | u32 addr; | 3400 | u32 addr; |
3468 | const char *name; | 3401 | const char *name; |
3469 | size_t size; | 3402 | size_t size; |
3470 | } nic_data[] = { | 3403 | } nic_data[] = { |
3471 | IPW2100_NIC(IPW2100_CONTROL_REG, 2), | 3404 | IPW2100_NIC(IPW2100_CONTROL_REG, 2), |
3472 | IPW2100_NIC(0x210014, 1), | 3405 | IPW2100_NIC(0x210014, 1), IPW2100_NIC(0x210000, 1),}; |
3473 | IPW2100_NIC(0x210000, 1), | ||
3474 | }; | ||
3475 | #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } | 3406 | #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } |
3476 | static const struct { | 3407 | static const struct { |
3477 | u8 index; | 3408 | u8 index; |
3478 | const char *name; | 3409 | const char *name; |
3479 | const char *desc; | 3410 | const char *desc; |
3480 | } ord_data[] = { | 3411 | } ord_data[] = { |
3481 | IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), | 3412 | IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), |
3482 | IPW2100_ORD(STAT_TX_HOST_COMPLETE, "successful Host Tx's (MSDU)"), | 3413 | IPW2100_ORD(STAT_TX_HOST_COMPLETE, |
3483 | IPW2100_ORD(STAT_TX_DIR_DATA, "successful Directed Tx's (MSDU)"), | 3414 | "successful Host Tx's (MSDU)"), |
3484 | IPW2100_ORD(STAT_TX_DIR_DATA1, "successful Directed Tx's (MSDU) @ 1MB"), | 3415 | IPW2100_ORD(STAT_TX_DIR_DATA, |
3485 | IPW2100_ORD(STAT_TX_DIR_DATA2, "successful Directed Tx's (MSDU) @ 2MB"), | 3416 | "successful Directed Tx's (MSDU)"), |
3486 | IPW2100_ORD(STAT_TX_DIR_DATA5_5, "successful Directed Tx's (MSDU) @ 5_5MB"), | 3417 | IPW2100_ORD(STAT_TX_DIR_DATA1, |
3487 | IPW2100_ORD(STAT_TX_DIR_DATA11, "successful Directed Tx's (MSDU) @ 11MB"), | 3418 | "successful Directed Tx's (MSDU) @ 1MB"), |
3488 | IPW2100_ORD(STAT_TX_NODIR_DATA1, "successful Non_Directed Tx's (MSDU) @ 1MB"), | 3419 | IPW2100_ORD(STAT_TX_DIR_DATA2, |
3489 | IPW2100_ORD(STAT_TX_NODIR_DATA2, "successful Non_Directed Tx's (MSDU) @ 2MB"), | 3420 | "successful Directed Tx's (MSDU) @ 2MB"), |
3490 | IPW2100_ORD(STAT_TX_NODIR_DATA5_5, "successful Non_Directed Tx's (MSDU) @ 5.5MB"), | 3421 | IPW2100_ORD(STAT_TX_DIR_DATA5_5, |
3491 | IPW2100_ORD(STAT_TX_NODIR_DATA11, "successful Non_Directed Tx's (MSDU) @ 11MB"), | 3422 | "successful Directed Tx's (MSDU) @ 5_5MB"), |
3492 | IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), | 3423 | IPW2100_ORD(STAT_TX_DIR_DATA11, |
3493 | IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), | 3424 | "successful Directed Tx's (MSDU) @ 11MB"), |
3494 | IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), | 3425 | IPW2100_ORD(STAT_TX_NODIR_DATA1, |
3495 | IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), | 3426 | "successful Non_Directed Tx's (MSDU) @ 1MB"), |
3496 | IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), | 3427 | IPW2100_ORD(STAT_TX_NODIR_DATA2, |
3497 | IPW2100_ORD(STAT_TX_ASSN_RESP, "successful Association response Tx's"), | 3428 | "successful Non_Directed Tx's (MSDU) @ 2MB"), |
3498 | IPW2100_ORD(STAT_TX_REASSN, "successful Reassociation Tx's"), | 3429 | IPW2100_ORD(STAT_TX_NODIR_DATA5_5, |
3499 | IPW2100_ORD(STAT_TX_REASSN_RESP, "successful Reassociation response Tx's"), | 3430 | "successful Non_Directed Tx's (MSDU) @ 5.5MB"), |
3500 | IPW2100_ORD(STAT_TX_PROBE, "probes successfully transmitted"), | 3431 | IPW2100_ORD(STAT_TX_NODIR_DATA11, |
3501 | IPW2100_ORD(STAT_TX_PROBE_RESP, "probe responses successfully transmitted"), | 3432 | "successful Non_Directed Tx's (MSDU) @ 11MB"), |
3502 | IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), | 3433 | IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), |
3503 | IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), | 3434 | IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), |
3504 | IPW2100_ORD(STAT_TX_DISASSN, "successful Disassociation TX"), | 3435 | IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), |
3505 | IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), | 3436 | IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), |
3506 | IPW2100_ORD(STAT_TX_DEAUTH, "successful Deauthentication TX"), | 3437 | IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), |
3507 | IPW2100_ORD(STAT_TX_TOTAL_BYTES, "Total successful Tx data bytes"), | 3438 | IPW2100_ORD(STAT_TX_ASSN_RESP, |
3508 | IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), | 3439 | "successful Association response Tx's"), |
3509 | IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), | 3440 | IPW2100_ORD(STAT_TX_REASSN, |
3510 | IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), | 3441 | "successful Reassociation Tx's"), |
3511 | IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), | 3442 | IPW2100_ORD(STAT_TX_REASSN_RESP, |
3512 | IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), | 3443 | "successful Reassociation response Tx's"), |
3513 | IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), | 3444 | IPW2100_ORD(STAT_TX_PROBE, |
3514 | IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP,"times max tries in a hop failed"), | 3445 | "probes successfully transmitted"), |
3515 | IPW2100_ORD(STAT_TX_DISASSN_FAIL, "times disassociation failed"), | 3446 | IPW2100_ORD(STAT_TX_PROBE_RESP, |
3516 | IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), | 3447 | "probe responses successfully transmitted"), |
3517 | IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), | 3448 | IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), |
3518 | IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), | 3449 | IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), |
3519 | IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), | 3450 | IPW2100_ORD(STAT_TX_DISASSN, |
3520 | IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), | 3451 | "successful Disassociation TX"), |
3521 | IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), | 3452 | IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), |
3522 | IPW2100_ORD(STAT_RX_DIR_DATA5_5, "directed packets at 5.5MB"), | 3453 | IPW2100_ORD(STAT_TX_DEAUTH, |
3523 | IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), | 3454 | "successful Deauthentication TX"), |
3524 | IPW2100_ORD(STAT_RX_NODIR_DATA,"nondirected packets"), | 3455 | IPW2100_ORD(STAT_TX_TOTAL_BYTES, |
3525 | IPW2100_ORD(STAT_RX_NODIR_DATA1, "nondirected packets at 1MB"), | 3456 | "Total successful Tx data bytes"), |
3526 | IPW2100_ORD(STAT_RX_NODIR_DATA2, "nondirected packets at 2MB"), | 3457 | IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), |
3527 | IPW2100_ORD(STAT_RX_NODIR_DATA5_5, "nondirected packets at 5.5MB"), | 3458 | IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), |
3528 | IPW2100_ORD(STAT_RX_NODIR_DATA11, "nondirected packets at 11MB"), | 3459 | IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), |
3529 | IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), | 3460 | IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), |
3530 | IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), | 3461 | IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), |
3531 | IPW2100_ORD(STAT_RX_CTS, "Rx CTS"), | 3462 | IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), |
3532 | IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), | 3463 | IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP, |
3533 | IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), | 3464 | "times max tries in a hop failed"), |
3534 | IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), | 3465 | IPW2100_ORD(STAT_TX_DISASSN_FAIL, |
3535 | IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), | 3466 | "times disassociation failed"), |
3536 | IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), | 3467 | IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), |
3537 | IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), | 3468 | IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), |
3538 | IPW2100_ORD(STAT_RX_REASSN_RESP, "Reassociation response Rx's"), | 3469 | IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), |
3539 | IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), | 3470 | IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), |
3540 | IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), | 3471 | IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), |
3541 | IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), | 3472 | IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), |
3542 | IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), | 3473 | IPW2100_ORD(STAT_RX_DIR_DATA5_5, |
3543 | IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), | 3474 | "directed packets at 5.5MB"), |
3544 | IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), | 3475 | IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), |
3545 | IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), | 3476 | IPW2100_ORD(STAT_RX_NODIR_DATA, "nondirected packets"), |
3546 | IPW2100_ORD(STAT_RX_TOTAL_BYTES,"Total rx data bytes received"), | 3477 | IPW2100_ORD(STAT_RX_NODIR_DATA1, |
3547 | IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), | 3478 | "nondirected packets at 1MB"), |
3548 | IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), | 3479 | IPW2100_ORD(STAT_RX_NODIR_DATA2, |
3549 | IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), | 3480 | "nondirected packets at 2MB"), |
3550 | IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), | 3481 | IPW2100_ORD(STAT_RX_NODIR_DATA5_5, |
3551 | IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), | 3482 | "nondirected packets at 5.5MB"), |
3552 | IPW2100_ORD(STAT_RX_DUPLICATE1, "duplicate rx packets at 1MB"), | 3483 | IPW2100_ORD(STAT_RX_NODIR_DATA11, |
3553 | IPW2100_ORD(STAT_RX_DUPLICATE2, "duplicate rx packets at 2MB"), | 3484 | "nondirected packets at 11MB"), |
3554 | IPW2100_ORD(STAT_RX_DUPLICATE5_5, "duplicate rx packets at 5.5MB"), | 3485 | IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), |
3555 | IPW2100_ORD(STAT_RX_DUPLICATE11, "duplicate rx packets at 11MB"), | 3486 | IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), IPW2100_ORD(STAT_RX_CTS, |
3556 | IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), | 3487 | "Rx CTS"), |
3557 | IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), | 3488 | IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), |
3558 | IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), | 3489 | IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), |
3559 | IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), | 3490 | IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), |
3560 | IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, "rx frames with invalid protocol"), | 3491 | IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), |
3561 | IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), | 3492 | IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), |
3562 | IPW2100_ORD(STAT_RX_NO_BUFFER, "rx frames rejected due to no buffer"), | 3493 | IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), |
3563 | IPW2100_ORD(STAT_RX_MISSING_FRAG, "rx frames dropped due to missing fragment"), | 3494 | IPW2100_ORD(STAT_RX_REASSN_RESP, |
3564 | IPW2100_ORD(STAT_RX_ORPHAN_FRAG, "rx frames dropped due to non-sequential fragment"), | 3495 | "Reassociation response Rx's"), |
3565 | IPW2100_ORD(STAT_RX_ORPHAN_FRAME, "rx frames dropped due to unmatched 1st frame"), | 3496 | IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), |
3566 | IPW2100_ORD(STAT_RX_FRAG_AGEOUT, "rx frames dropped due to uncompleted frame"), | 3497 | IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), |
3567 | IPW2100_ORD(STAT_RX_ICV_ERRORS, "ICV errors during decryption"), | 3498 | IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), |
3568 | IPW2100_ORD(STAT_PSP_SUSPENSION,"times adapter suspended"), | 3499 | IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), |
3569 | IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), | 3500 | IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), |
3570 | IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, "poll response timeouts"), | 3501 | IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), |
3571 | IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, "timeouts waiting for last {broad,multi}cast pkt"), | 3502 | IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), |
3572 | IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), | 3503 | IPW2100_ORD(STAT_RX_TOTAL_BYTES, |
3573 | IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), | 3504 | "Total rx data bytes received"), |
3574 | IPW2100_ORD(STAT_PSP_STATION_ID,"PSP Station ID"), | 3505 | IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), |
3575 | IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), | 3506 | IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), |
3576 | IPW2100_ORD(STAT_PERCENT_MISSED_BCNS,"current calculation of % missed beacons"), | 3507 | IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), |
3577 | IPW2100_ORD(STAT_PERCENT_RETRIES,"current calculation of % missed tx retries"), | 3508 | IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), |
3578 | IPW2100_ORD(ASSOCIATED_AP_PTR, "0 if not associated, else pointer to AP table entry"), | 3509 | IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), |
3579 | IPW2100_ORD(AVAILABLE_AP_CNT, "AP's decsribed in the AP table"), | 3510 | IPW2100_ORD(STAT_RX_DUPLICATE1, |
3580 | IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), | 3511 | "duplicate rx packets at 1MB"), |
3581 | IPW2100_ORD(STAT_AP_ASSNS, "associations"), | 3512 | IPW2100_ORD(STAT_RX_DUPLICATE2, |
3582 | IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), | 3513 | "duplicate rx packets at 2MB"), |
3583 | IPW2100_ORD(STAT_ASSN_RESP_FAIL,"failures due to response fail"), | 3514 | IPW2100_ORD(STAT_RX_DUPLICATE5_5, |
3584 | IPW2100_ORD(STAT_FULL_SCANS, "full scans"), | 3515 | "duplicate rx packets at 5.5MB"), |
3585 | IPW2100_ORD(CARD_DISABLED, "Card Disabled"), | 3516 | IPW2100_ORD(STAT_RX_DUPLICATE11, |
3586 | IPW2100_ORD(STAT_ROAM_INHIBIT, "times roaming was inhibited due to activity"), | 3517 | "duplicate rx packets at 11MB"), |
3587 | IPW2100_ORD(RSSI_AT_ASSN, "RSSI of associated AP at time of association"), | 3518 | IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), |
3588 | IPW2100_ORD(STAT_ASSN_CAUSE1, "reassociation: no probe response or TX on hop"), | 3519 | IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), |
3589 | IPW2100_ORD(STAT_ASSN_CAUSE2, "reassociation: poor tx/rx quality"), | 3520 | IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), |
3590 | IPW2100_ORD(STAT_ASSN_CAUSE3, "reassociation: tx/rx quality (excessive AP load"), | 3521 | IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), |
3591 | IPW2100_ORD(STAT_ASSN_CAUSE4, "reassociation: AP RSSI level"), | 3522 | IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, |
3592 | IPW2100_ORD(STAT_ASSN_CAUSE5, "reassociations due to load leveling"), | 3523 | "rx frames with invalid protocol"), |
3593 | IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), | 3524 | IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), |
3594 | IPW2100_ORD(STAT_AUTH_RESP_FAIL,"times authentication response failed"), | 3525 | IPW2100_ORD(STAT_RX_NO_BUFFER, |
3595 | IPW2100_ORD(STATION_TABLE_CNT, "entries in association table"), | 3526 | "rx frames rejected due to no buffer"), |
3596 | IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), | 3527 | IPW2100_ORD(STAT_RX_MISSING_FRAG, |
3597 | IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), | 3528 | "rx frames dropped due to missing fragment"), |
3598 | IPW2100_ORD(COUNTRY_CODE, "IEEE country code as recv'd from beacon"), | 3529 | IPW2100_ORD(STAT_RX_ORPHAN_FRAG, |
3599 | IPW2100_ORD(COUNTRY_CHANNELS, "channels suported by country"), | 3530 | "rx frames dropped due to non-sequential fragment"), |
3600 | IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), | 3531 | IPW2100_ORD(STAT_RX_ORPHAN_FRAME, |
3601 | IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), | 3532 | "rx frames dropped due to unmatched 1st frame"), |
3602 | IPW2100_ORD(ANTENNA_DIVERSITY, "TRUE if antenna diversity is disabled"), | 3533 | IPW2100_ORD(STAT_RX_FRAG_AGEOUT, |
3603 | IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), | 3534 | "rx frames dropped due to uncompleted frame"), |
3604 | IPW2100_ORD(OUR_FREQ, "current radio freq lower digits - channel ID"), | 3535 | IPW2100_ORD(STAT_RX_ICV_ERRORS, |
3605 | IPW2100_ORD(RTC_TIME, "current RTC time"), | 3536 | "ICV errors during decryption"), |
3606 | IPW2100_ORD(PORT_TYPE, "operating mode"), | 3537 | IPW2100_ORD(STAT_PSP_SUSPENSION, "times adapter suspended"), |
3607 | IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), | 3538 | IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), |
3608 | IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), | 3539 | IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, |
3609 | IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), | 3540 | "poll response timeouts"), |
3610 | IPW2100_ORD(BASIC_RATES, "basic tx rates"), | 3541 | IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, |
3611 | IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), | 3542 | "timeouts waiting for last {broad,multi}cast pkt"), |
3612 | IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), | 3543 | IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), |
3613 | IPW2100_ORD(CAPABILITIES, "Management frame capability field"), | 3544 | IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), |
3614 | IPW2100_ORD(AUTH_TYPE, "Type of authentication"), | 3545 | IPW2100_ORD(STAT_PSP_STATION_ID, "PSP Station ID"), |
3615 | IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), | 3546 | IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), |
3616 | IPW2100_ORD(RTS_THRESHOLD, "Min packet length for RTS handshaking"), | 3547 | IPW2100_ORD(STAT_PERCENT_MISSED_BCNS, |
3617 | IPW2100_ORD(INT_MODE, "International mode"), | 3548 | "current calculation of % missed beacons"), |
3618 | IPW2100_ORD(FRAGMENTATION_THRESHOLD, "protocol frag threshold"), | 3549 | IPW2100_ORD(STAT_PERCENT_RETRIES, |
3619 | IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, "EEPROM offset in SRAM"), | 3550 | "current calculation of % missed tx retries"), |
3620 | IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, "EEPROM size in SRAM"), | 3551 | IPW2100_ORD(ASSOCIATED_AP_PTR, |
3621 | IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), | 3552 | "0 if not associated, else pointer to AP table entry"), |
3622 | IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, "EEPROM IBSS 11b channel set"), | 3553 | IPW2100_ORD(AVAILABLE_AP_CNT, |
3623 | IPW2100_ORD(MAC_VERSION, "MAC Version"), | 3554 | "AP's decsribed in the AP table"), |
3624 | IPW2100_ORD(MAC_REVISION, "MAC Revision"), | 3555 | IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), |
3625 | IPW2100_ORD(RADIO_VERSION, "Radio Version"), | 3556 | IPW2100_ORD(STAT_AP_ASSNS, "associations"), |
3626 | IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), | 3557 | IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), |
3627 | IPW2100_ORD(UCODE_VERSION, "Ucode Version"), | 3558 | IPW2100_ORD(STAT_ASSN_RESP_FAIL, |
3628 | }; | 3559 | "failures due to response fail"), |
3629 | 3560 | IPW2100_ORD(STAT_FULL_SCANS, "full scans"), | |
3561 | IPW2100_ORD(CARD_DISABLED, "Card Disabled"), | ||
3562 | IPW2100_ORD(STAT_ROAM_INHIBIT, | ||
3563 | "times roaming was inhibited due to activity"), | ||
3564 | IPW2100_ORD(RSSI_AT_ASSN, | ||
3565 | "RSSI of associated AP at time of association"), | ||
3566 | IPW2100_ORD(STAT_ASSN_CAUSE1, | ||
3567 | "reassociation: no probe response or TX on hop"), | ||
3568 | IPW2100_ORD(STAT_ASSN_CAUSE2, | ||
3569 | "reassociation: poor tx/rx quality"), | ||
3570 | IPW2100_ORD(STAT_ASSN_CAUSE3, | ||
3571 | "reassociation: tx/rx quality (excessive AP load"), | ||
3572 | IPW2100_ORD(STAT_ASSN_CAUSE4, | ||
3573 | "reassociation: AP RSSI level"), | ||
3574 | IPW2100_ORD(STAT_ASSN_CAUSE5, | ||
3575 | "reassociations due to load leveling"), | ||
3576 | IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), | ||
3577 | IPW2100_ORD(STAT_AUTH_RESP_FAIL, | ||
3578 | "times authentication response failed"), | ||
3579 | IPW2100_ORD(STATION_TABLE_CNT, | ||
3580 | "entries in association table"), | ||
3581 | IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), | ||
3582 | IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), | ||
3583 | IPW2100_ORD(COUNTRY_CODE, | ||
3584 | "IEEE country code as recv'd from beacon"), | ||
3585 | IPW2100_ORD(COUNTRY_CHANNELS, | ||
3586 | "channels suported by country"), | ||
3587 | IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), | ||
3588 | IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), | ||
3589 | IPW2100_ORD(ANTENNA_DIVERSITY, | ||
3590 | "TRUE if antenna diversity is disabled"), | ||
3591 | IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), | ||
3592 | IPW2100_ORD(OUR_FREQ, | ||
3593 | "current radio freq lower digits - channel ID"), | ||
3594 | IPW2100_ORD(RTC_TIME, "current RTC time"), | ||
3595 | IPW2100_ORD(PORT_TYPE, "operating mode"), | ||
3596 | IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), | ||
3597 | IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), | ||
3598 | IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), | ||
3599 | IPW2100_ORD(BASIC_RATES, "basic tx rates"), | ||
3600 | IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), | ||
3601 | IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), | ||
3602 | IPW2100_ORD(CAPABILITIES, | ||
3603 | "Management frame capability field"), | ||
3604 | IPW2100_ORD(AUTH_TYPE, "Type of authentication"), | ||
3605 | IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), | ||
3606 | IPW2100_ORD(RTS_THRESHOLD, | ||
3607 | "Min packet length for RTS handshaking"), | ||
3608 | IPW2100_ORD(INT_MODE, "International mode"), | ||
3609 | IPW2100_ORD(FRAGMENTATION_THRESHOLD, | ||
3610 | "protocol frag threshold"), | ||
3611 | IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, | ||
3612 | "EEPROM offset in SRAM"), | ||
3613 | IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, | ||
3614 | "EEPROM size in SRAM"), | ||
3615 | IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), | ||
3616 | IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, | ||
3617 | "EEPROM IBSS 11b channel set"), | ||
3618 | IPW2100_ORD(MAC_VERSION, "MAC Version"), | ||
3619 | IPW2100_ORD(MAC_REVISION, "MAC Revision"), | ||
3620 | IPW2100_ORD(RADIO_VERSION, "Radio Version"), | ||
3621 | IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), | ||
3622 | IPW2100_ORD(UCODE_VERSION, "Ucode Version"),}; | ||
3630 | 3623 | ||
3631 | static ssize_t show_registers(struct device *d, struct device_attribute *attr, | 3624 | static ssize_t show_registers(struct device *d, struct device_attribute *attr, |
3632 | char *buf) | 3625 | char *buf) |
3633 | { | 3626 | { |
3634 | int i; | 3627 | int i; |
3635 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3628 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3636 | struct net_device *dev = priv->net_dev; | 3629 | struct net_device *dev = priv->net_dev; |
3637 | char * out = buf; | 3630 | char *out = buf; |
3638 | u32 val = 0; | 3631 | u32 val = 0; |
3639 | 3632 | ||
3640 | out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); | 3633 | out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); |
@@ -3647,15 +3640,15 @@ static ssize_t show_registers(struct device *d, struct device_attribute *attr, | |||
3647 | 3640 | ||
3648 | return out - buf; | 3641 | return out - buf; |
3649 | } | 3642 | } |
3650 | static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); | ||
3651 | 3643 | ||
3644 | static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); | ||
3652 | 3645 | ||
3653 | static ssize_t show_hardware(struct device *d, struct device_attribute *attr, | 3646 | static ssize_t show_hardware(struct device *d, struct device_attribute *attr, |
3654 | char *buf) | 3647 | char *buf) |
3655 | { | 3648 | { |
3656 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3649 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3657 | struct net_device *dev = priv->net_dev; | 3650 | struct net_device *dev = priv->net_dev; |
3658 | char * out = buf; | 3651 | char *out = buf; |
3659 | int i; | 3652 | int i; |
3660 | 3653 | ||
3661 | out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); | 3654 | out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); |
@@ -3688,11 +3681,11 @@ static ssize_t show_hardware(struct device *d, struct device_attribute *attr, | |||
3688 | } | 3681 | } |
3689 | return out - buf; | 3682 | return out - buf; |
3690 | } | 3683 | } |
3691 | static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); | ||
3692 | 3684 | ||
3685 | static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); | ||
3693 | 3686 | ||
3694 | static ssize_t show_memory(struct device *d, struct device_attribute *attr, | 3687 | static ssize_t show_memory(struct device *d, struct device_attribute *attr, |
3695 | char *buf) | 3688 | char *buf) |
3696 | { | 3689 | { |
3697 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3690 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3698 | struct net_device *dev = priv->net_dev; | 3691 | struct net_device *dev = priv->net_dev; |
@@ -3708,10 +3701,13 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, | |||
3708 | /* sysfs provides us PAGE_SIZE buffer */ | 3701 | /* sysfs provides us PAGE_SIZE buffer */ |
3709 | while (len < PAGE_SIZE - 128 && loop < 0x30000) { | 3702 | while (len < PAGE_SIZE - 128 && loop < 0x30000) { |
3710 | 3703 | ||
3711 | if (priv->snapshot[0]) for (i = 0; i < 4; i++) | 3704 | if (priv->snapshot[0]) |
3712 | buffer[i] = *(u32 *)SNAPSHOT_ADDR(loop + i * 4); | 3705 | for (i = 0; i < 4; i++) |
3713 | else for (i = 0; i < 4; i++) | 3706 | buffer[i] = |
3714 | read_nic_dword(dev, loop + i * 4, &buffer[i]); | 3707 | *(u32 *) SNAPSHOT_ADDR(loop + i * 4); |
3708 | else | ||
3709 | for (i = 0; i < 4; i++) | ||
3710 | read_nic_dword(dev, loop + i * 4, &buffer[i]); | ||
3715 | 3711 | ||
3716 | if (priv->dump_raw) | 3712 | if (priv->dump_raw) |
3717 | len += sprintf(buf + len, | 3713 | len += sprintf(buf + len, |
@@ -3719,26 +3715,26 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, | |||
3719 | "%c%c%c%c" | 3715 | "%c%c%c%c" |
3720 | "%c%c%c%c" | 3716 | "%c%c%c%c" |
3721 | "%c%c%c%c", | 3717 | "%c%c%c%c", |
3722 | ((u8*)buffer)[0x0], | 3718 | ((u8 *) buffer)[0x0], |
3723 | ((u8*)buffer)[0x1], | 3719 | ((u8 *) buffer)[0x1], |
3724 | ((u8*)buffer)[0x2], | 3720 | ((u8 *) buffer)[0x2], |
3725 | ((u8*)buffer)[0x3], | 3721 | ((u8 *) buffer)[0x3], |
3726 | ((u8*)buffer)[0x4], | 3722 | ((u8 *) buffer)[0x4], |
3727 | ((u8*)buffer)[0x5], | 3723 | ((u8 *) buffer)[0x5], |
3728 | ((u8*)buffer)[0x6], | 3724 | ((u8 *) buffer)[0x6], |
3729 | ((u8*)buffer)[0x7], | 3725 | ((u8 *) buffer)[0x7], |
3730 | ((u8*)buffer)[0x8], | 3726 | ((u8 *) buffer)[0x8], |
3731 | ((u8*)buffer)[0x9], | 3727 | ((u8 *) buffer)[0x9], |
3732 | ((u8*)buffer)[0xa], | 3728 | ((u8 *) buffer)[0xa], |
3733 | ((u8*)buffer)[0xb], | 3729 | ((u8 *) buffer)[0xb], |
3734 | ((u8*)buffer)[0xc], | 3730 | ((u8 *) buffer)[0xc], |
3735 | ((u8*)buffer)[0xd], | 3731 | ((u8 *) buffer)[0xd], |
3736 | ((u8*)buffer)[0xe], | 3732 | ((u8 *) buffer)[0xe], |
3737 | ((u8*)buffer)[0xf]); | 3733 | ((u8 *) buffer)[0xf]); |
3738 | else | 3734 | else |
3739 | len += sprintf(buf + len, "%s\n", | 3735 | len += sprintf(buf + len, "%s\n", |
3740 | snprint_line(line, sizeof(line), | 3736 | snprint_line(line, sizeof(line), |
3741 | (u8*)buffer, 16, loop)); | 3737 | (u8 *) buffer, 16, loop)); |
3742 | loop += 16; | 3738 | loop += 16; |
3743 | } | 3739 | } |
3744 | 3740 | ||
@@ -3746,44 +3742,44 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, | |||
3746 | } | 3742 | } |
3747 | 3743 | ||
3748 | static ssize_t store_memory(struct device *d, struct device_attribute *attr, | 3744 | static ssize_t store_memory(struct device *d, struct device_attribute *attr, |
3749 | const char *buf, size_t count) | 3745 | const char *buf, size_t count) |
3750 | { | 3746 | { |
3751 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3747 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3752 | struct net_device *dev = priv->net_dev; | 3748 | struct net_device *dev = priv->net_dev; |
3753 | const char *p = buf; | 3749 | const char *p = buf; |
3754 | 3750 | ||
3751 | (void) dev; /* kill unused-var warning for debug-only code */ | ||
3752 | |||
3755 | if (count < 1) | 3753 | if (count < 1) |
3756 | return count; | 3754 | return count; |
3757 | 3755 | ||
3758 | if (p[0] == '1' || | 3756 | if (p[0] == '1' || |
3759 | (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { | 3757 | (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { |
3760 | IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", | 3758 | IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", |
3761 | dev->name); | 3759 | dev->name); |
3762 | priv->dump_raw = 1; | 3760 | priv->dump_raw = 1; |
3763 | 3761 | ||
3764 | } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && | 3762 | } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && |
3765 | tolower(p[1]) == 'f')) { | 3763 | tolower(p[1]) == 'f')) { |
3766 | IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", | 3764 | IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", |
3767 | dev->name); | 3765 | dev->name); |
3768 | priv->dump_raw = 0; | 3766 | priv->dump_raw = 0; |
3769 | 3767 | ||
3770 | } else if (tolower(p[0]) == 'r') { | 3768 | } else if (tolower(p[0]) == 'r') { |
3771 | IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", | 3769 | IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", dev->name); |
3772 | dev->name); | ||
3773 | ipw2100_snapshot_free(priv); | 3770 | ipw2100_snapshot_free(priv); |
3774 | 3771 | ||
3775 | } else | 3772 | } else |
3776 | IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " | 3773 | IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " |
3777 | "reset = clear memory snapshot\n", | 3774 | "reset = clear memory snapshot\n", dev->name); |
3778 | dev->name); | ||
3779 | 3775 | ||
3780 | return count; | 3776 | return count; |
3781 | } | 3777 | } |
3782 | static DEVICE_ATTR(memory, S_IWUSR|S_IRUGO, show_memory, store_memory); | ||
3783 | 3778 | ||
3779 | static DEVICE_ATTR(memory, S_IWUSR | S_IRUGO, show_memory, store_memory); | ||
3784 | 3780 | ||
3785 | static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, | 3781 | static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, |
3786 | char *buf) | 3782 | char *buf) |
3787 | { | 3783 | { |
3788 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3784 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3789 | u32 val = 0; | 3785 | u32 val = 0; |
@@ -3791,6 +3787,9 @@ static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, | |||
3791 | u32 val_len; | 3787 | u32 val_len; |
3792 | static int loop = 0; | 3788 | static int loop = 0; |
3793 | 3789 | ||
3790 | if (priv->status & STATUS_RF_KILL_MASK) | ||
3791 | return 0; | ||
3792 | |||
3794 | if (loop >= sizeof(ord_data) / sizeof(*ord_data)) | 3793 | if (loop >= sizeof(ord_data) / sizeof(*ord_data)) |
3795 | loop = 0; | 3794 | loop = 0; |
3796 | 3795 | ||
@@ -3814,14 +3813,14 @@ static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, | |||
3814 | 3813 | ||
3815 | return len; | 3814 | return len; |
3816 | } | 3815 | } |
3817 | static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); | ||
3818 | 3816 | ||
3817 | static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); | ||
3819 | 3818 | ||
3820 | static ssize_t show_stats(struct device *d, struct device_attribute *attr, | 3819 | static ssize_t show_stats(struct device *d, struct device_attribute *attr, |
3821 | char *buf) | 3820 | char *buf) |
3822 | { | 3821 | { |
3823 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3822 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3824 | char * out = buf; | 3823 | char *out = buf; |
3825 | 3824 | ||
3826 | out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", | 3825 | out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", |
3827 | priv->interrupts, priv->tx_interrupts, | 3826 | priv->interrupts, priv->tx_interrupts, |
@@ -3835,8 +3834,8 @@ static ssize_t show_stats(struct device *d, struct device_attribute *attr, | |||
3835 | 3834 | ||
3836 | return out - buf; | 3835 | return out - buf; |
3837 | } | 3836 | } |
3838 | static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); | ||
3839 | 3837 | ||
3838 | static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); | ||
3840 | 3839 | ||
3841 | static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) | 3840 | static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) |
3842 | { | 3841 | { |
@@ -3864,19 +3863,18 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) | |||
3864 | priv->last_mode = priv->ieee->iw_mode; | 3863 | priv->last_mode = priv->ieee->iw_mode; |
3865 | priv->net_dev->type = ARPHRD_IEEE80211; | 3864 | priv->net_dev->type = ARPHRD_IEEE80211; |
3866 | break; | 3865 | break; |
3867 | #endif /* CONFIG_IPW2100_MONITOR */ | 3866 | #endif /* CONFIG_IPW2100_MONITOR */ |
3868 | } | 3867 | } |
3869 | 3868 | ||
3870 | priv->ieee->iw_mode = mode; | 3869 | priv->ieee->iw_mode = mode; |
3871 | 3870 | ||
3872 | #ifdef CONFIG_PM | 3871 | #ifdef CONFIG_PM |
3873 | /* Indicate ipw2100_download_firmware download firmware | 3872 | /* Indicate ipw2100_download_firmware download firmware |
3874 | * from disk instead of memory. */ | 3873 | * from disk instead of memory. */ |
3875 | ipw2100_firmware.version = 0; | 3874 | ipw2100_firmware.version = 0; |
3876 | #endif | 3875 | #endif |
3877 | 3876 | ||
3878 | printk(KERN_INFO "%s: Reseting on mode change.\n", | 3877 | printk(KERN_INFO "%s: Reseting on mode change.\n", priv->net_dev->name); |
3879 | priv->net_dev->name); | ||
3880 | priv->reset_backoff = 0; | 3878 | priv->reset_backoff = 0; |
3881 | schedule_reset(priv); | 3879 | schedule_reset(priv); |
3882 | 3880 | ||
@@ -3884,12 +3882,12 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) | |||
3884 | } | 3882 | } |
3885 | 3883 | ||
3886 | static ssize_t show_internals(struct device *d, struct device_attribute *attr, | 3884 | static ssize_t show_internals(struct device *d, struct device_attribute *attr, |
3887 | char *buf) | 3885 | char *buf) |
3888 | { | 3886 | { |
3889 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3887 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3890 | int len = 0; | 3888 | int len = 0; |
3891 | 3889 | ||
3892 | #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" # y "\n", priv-> x) | 3890 | #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) |
3893 | 3891 | ||
3894 | if (priv->status & STATUS_ASSOCIATED) | 3892 | if (priv->status & STATUS_ASSOCIATED) |
3895 | len += sprintf(buf + len, "connected: %lu\n", | 3893 | len += sprintf(buf + len, "connected: %lu\n", |
@@ -3897,55 +3895,60 @@ static ssize_t show_internals(struct device *d, struct device_attribute *attr, | |||
3897 | else | 3895 | else |
3898 | len += sprintf(buf + len, "not connected\n"); | 3896 | len += sprintf(buf + len, "not connected\n"); |
3899 | 3897 | ||
3900 | DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], p); | 3898 | DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], "p"); |
3901 | DUMP_VAR(status, 08lx); | 3899 | DUMP_VAR(status, "08lx"); |
3902 | DUMP_VAR(config, 08lx); | 3900 | DUMP_VAR(config, "08lx"); |
3903 | DUMP_VAR(capability, 08lx); | 3901 | DUMP_VAR(capability, "08lx"); |
3904 | 3902 | ||
3905 | len += sprintf(buf + len, "last_rtc: %lu\n", (unsigned long)priv->last_rtc); | 3903 | len += |
3904 | sprintf(buf + len, "last_rtc: %lu\n", | ||
3905 | (unsigned long)priv->last_rtc); | ||
3906 | 3906 | ||
3907 | DUMP_VAR(fatal_error, d); | 3907 | DUMP_VAR(fatal_error, "d"); |
3908 | DUMP_VAR(stop_hang_check, d); | 3908 | DUMP_VAR(stop_hang_check, "d"); |
3909 | DUMP_VAR(stop_rf_kill, d); | 3909 | DUMP_VAR(stop_rf_kill, "d"); |
3910 | DUMP_VAR(messages_sent, d); | 3910 | DUMP_VAR(messages_sent, "d"); |
3911 | 3911 | ||
3912 | DUMP_VAR(tx_pend_stat.value, d); | 3912 | DUMP_VAR(tx_pend_stat.value, "d"); |
3913 | DUMP_VAR(tx_pend_stat.hi, d); | 3913 | DUMP_VAR(tx_pend_stat.hi, "d"); |
3914 | 3914 | ||
3915 | DUMP_VAR(tx_free_stat.value, d); | 3915 | DUMP_VAR(tx_free_stat.value, "d"); |
3916 | DUMP_VAR(tx_free_stat.lo, d); | 3916 | DUMP_VAR(tx_free_stat.lo, "d"); |
3917 | 3917 | ||
3918 | DUMP_VAR(msg_free_stat.value, d); | 3918 | DUMP_VAR(msg_free_stat.value, "d"); |
3919 | DUMP_VAR(msg_free_stat.lo, d); | 3919 | DUMP_VAR(msg_free_stat.lo, "d"); |
3920 | 3920 | ||
3921 | DUMP_VAR(msg_pend_stat.value, d); | 3921 | DUMP_VAR(msg_pend_stat.value, "d"); |
3922 | DUMP_VAR(msg_pend_stat.hi, d); | 3922 | DUMP_VAR(msg_pend_stat.hi, "d"); |
3923 | 3923 | ||
3924 | DUMP_VAR(fw_pend_stat.value, d); | 3924 | DUMP_VAR(fw_pend_stat.value, "d"); |
3925 | DUMP_VAR(fw_pend_stat.hi, d); | 3925 | DUMP_VAR(fw_pend_stat.hi, "d"); |
3926 | 3926 | ||
3927 | DUMP_VAR(txq_stat.value, d); | 3927 | DUMP_VAR(txq_stat.value, "d"); |
3928 | DUMP_VAR(txq_stat.lo, d); | 3928 | DUMP_VAR(txq_stat.lo, "d"); |
3929 | 3929 | ||
3930 | DUMP_VAR(ieee->scans, d); | 3930 | DUMP_VAR(ieee->scans, "d"); |
3931 | DUMP_VAR(reset_backoff, d); | 3931 | DUMP_VAR(reset_backoff, "d"); |
3932 | 3932 | ||
3933 | return len; | 3933 | return len; |
3934 | } | 3934 | } |
3935 | static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); | ||
3936 | 3935 | ||
3936 | static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); | ||
3937 | 3937 | ||
3938 | static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, | 3938 | static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, |
3939 | char *buf) | 3939 | char *buf) |
3940 | { | 3940 | { |
3941 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3941 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3942 | char essid[IW_ESSID_MAX_SIZE + 1]; | 3942 | char essid[IW_ESSID_MAX_SIZE + 1]; |
3943 | u8 bssid[ETH_ALEN]; | 3943 | u8 bssid[ETH_ALEN]; |
3944 | u32 chan = 0; | 3944 | u32 chan = 0; |
3945 | char * out = buf; | 3945 | char *out = buf; |
3946 | int length; | 3946 | int length; |
3947 | int ret; | 3947 | int ret; |
3948 | 3948 | ||
3949 | if (priv->status & STATUS_RF_KILL_MASK) | ||
3950 | return 0; | ||
3951 | |||
3949 | memset(essid, 0, sizeof(essid)); | 3952 | memset(essid, 0, sizeof(essid)); |
3950 | memset(bssid, 0, sizeof(bssid)); | 3953 | memset(bssid, 0, sizeof(bssid)); |
3951 | 3954 | ||
@@ -3976,8 +3979,8 @@ static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, | |||
3976 | 3979 | ||
3977 | return out - buf; | 3980 | return out - buf; |
3978 | } | 3981 | } |
3979 | static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); | ||
3980 | 3982 | ||
3983 | static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); | ||
3981 | 3984 | ||
3982 | #ifdef CONFIG_IPW_DEBUG | 3985 | #ifdef CONFIG_IPW_DEBUG |
3983 | static ssize_t show_debug_level(struct device_driver *d, char *buf) | 3986 | static ssize_t show_debug_level(struct device_driver *d, char *buf) |
@@ -3985,8 +3988,8 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf) | |||
3985 | return sprintf(buf, "0x%08X\n", ipw2100_debug_level); | 3988 | return sprintf(buf, "0x%08X\n", ipw2100_debug_level); |
3986 | } | 3989 | } |
3987 | 3990 | ||
3988 | static ssize_t store_debug_level(struct device_driver *d, const char *buf, | 3991 | static ssize_t store_debug_level(struct device_driver *d, |
3989 | size_t count) | 3992 | const char *buf, size_t count) |
3990 | { | 3993 | { |
3991 | char *p = (char *)buf; | 3994 | char *p = (char *)buf; |
3992 | u32 val; | 3995 | u32 val; |
@@ -3999,28 +4002,26 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf, | |||
3999 | } else | 4002 | } else |
4000 | val = simple_strtoul(p, &p, 10); | 4003 | val = simple_strtoul(p, &p, 10); |
4001 | if (p == buf) | 4004 | if (p == buf) |
4002 | IPW_DEBUG_INFO(DRV_NAME | 4005 | IPW_DEBUG_INFO(": %s is not in hex or decimal form.\n", buf); |
4003 | ": %s is not in hex or decimal form.\n", buf); | ||
4004 | else | 4006 | else |
4005 | ipw2100_debug_level = val; | 4007 | ipw2100_debug_level = val; |
4006 | 4008 | ||
4007 | return strnlen(buf, count); | 4009 | return strnlen(buf, count); |
4008 | } | 4010 | } |
4011 | |||
4009 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, | 4012 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, |
4010 | store_debug_level); | 4013 | store_debug_level); |
4011 | #endif /* CONFIG_IPW_DEBUG */ | 4014 | #endif /* CONFIG_IPW_DEBUG */ |
4012 | |||
4013 | 4015 | ||
4014 | static ssize_t show_fatal_error(struct device *d, | 4016 | static ssize_t show_fatal_error(struct device *d, |
4015 | struct device_attribute *attr, char *buf) | 4017 | struct device_attribute *attr, char *buf) |
4016 | { | 4018 | { |
4017 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4019 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4018 | char *out = buf; | 4020 | char *out = buf; |
4019 | int i; | 4021 | int i; |
4020 | 4022 | ||
4021 | if (priv->fatal_error) | 4023 | if (priv->fatal_error) |
4022 | out += sprintf(out, "0x%08X\n", | 4024 | out += sprintf(out, "0x%08X\n", priv->fatal_error); |
4023 | priv->fatal_error); | ||
4024 | else | 4025 | else |
4025 | out += sprintf(out, "0\n"); | 4026 | out += sprintf(out, "0\n"); |
4026 | 4027 | ||
@@ -4038,24 +4039,26 @@ static ssize_t show_fatal_error(struct device *d, | |||
4038 | } | 4039 | } |
4039 | 4040 | ||
4040 | static ssize_t store_fatal_error(struct device *d, | 4041 | static ssize_t store_fatal_error(struct device *d, |
4041 | struct device_attribute *attr, const char *buf, size_t count) | 4042 | struct device_attribute *attr, const char *buf, |
4043 | size_t count) | ||
4042 | { | 4044 | { |
4043 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4045 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4044 | schedule_reset(priv); | 4046 | schedule_reset(priv); |
4045 | return count; | 4047 | return count; |
4046 | } | 4048 | } |
4047 | static DEVICE_ATTR(fatal_error, S_IWUSR|S_IRUGO, show_fatal_error, store_fatal_error); | ||
4048 | 4049 | ||
4050 | static DEVICE_ATTR(fatal_error, S_IWUSR | S_IRUGO, show_fatal_error, | ||
4051 | store_fatal_error); | ||
4049 | 4052 | ||
4050 | static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, | 4053 | static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, |
4051 | char *buf) | 4054 | char *buf) |
4052 | { | 4055 | { |
4053 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4056 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4054 | return sprintf(buf, "%d\n", priv->ieee->scan_age); | 4057 | return sprintf(buf, "%d\n", priv->ieee->scan_age); |
4055 | } | 4058 | } |
4056 | 4059 | ||
4057 | static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | 4060 | static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, |
4058 | const char *buf, size_t count) | 4061 | const char *buf, size_t count) |
4059 | { | 4062 | { |
4060 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4063 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4061 | struct net_device *dev = priv->net_dev; | 4064 | struct net_device *dev = priv->net_dev; |
@@ -4065,6 +4068,8 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | |||
4065 | unsigned long val; | 4068 | unsigned long val; |
4066 | char *p = buffer; | 4069 | char *p = buffer; |
4067 | 4070 | ||
4071 | (void) dev; /* kill unused-var warning for debug-only code */ | ||
4072 | |||
4068 | IPW_DEBUG_INFO("enter\n"); | 4073 | IPW_DEBUG_INFO("enter\n"); |
4069 | 4074 | ||
4070 | strncpy(buffer, buf, len); | 4075 | strncpy(buffer, buf, len); |
@@ -4078,8 +4083,7 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | |||
4078 | } else | 4083 | } else |
4079 | val = simple_strtoul(p, &p, 10); | 4084 | val = simple_strtoul(p, &p, 10); |
4080 | if (p == buffer) { | 4085 | if (p == buffer) { |
4081 | IPW_DEBUG_INFO("%s: user supplied invalid value.\n", | 4086 | IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); |
4082 | dev->name); | ||
4083 | } else { | 4087 | } else { |
4084 | priv->ieee->scan_age = val; | 4088 | priv->ieee->scan_age = val; |
4085 | IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); | 4089 | IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); |
@@ -4088,11 +4092,11 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | |||
4088 | IPW_DEBUG_INFO("exit\n"); | 4092 | IPW_DEBUG_INFO("exit\n"); |
4089 | return len; | 4093 | return len; |
4090 | } | 4094 | } |
4091 | static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); | ||
4092 | 4095 | ||
4096 | static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); | ||
4093 | 4097 | ||
4094 | static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, | 4098 | static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, |
4095 | char *buf) | 4099 | char *buf) |
4096 | { | 4100 | { |
4097 | /* 0 - RF kill not enabled | 4101 | /* 0 - RF kill not enabled |
4098 | 1 - SW based RF kill active (sysfs) | 4102 | 1 - SW based RF kill active (sysfs) |
@@ -4100,7 +4104,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, | |||
4100 | 3 - Both HW and SW baed RF kill active */ | 4104 | 3 - Both HW and SW baed RF kill active */ |
4101 | struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data; | 4105 | struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data; |
4102 | int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | | 4106 | int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | |
4103 | (rf_kill_active(priv) ? 0x2 : 0x0); | 4107 | (rf_kill_active(priv) ? 0x2 : 0x0); |
4104 | return sprintf(buf, "%i\n", val); | 4108 | return sprintf(buf, "%i\n", val); |
4105 | } | 4109 | } |
4106 | 4110 | ||
@@ -4108,7 +4112,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
4108 | { | 4112 | { |
4109 | if ((disable_radio ? 1 : 0) == | 4113 | if ((disable_radio ? 1 : 0) == |
4110 | (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) | 4114 | (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) |
4111 | return 0 ; | 4115 | return 0; |
4112 | 4116 | ||
4113 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", | 4117 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", |
4114 | disable_radio ? "OFF" : "ON"); | 4118 | disable_radio ? "OFF" : "ON"); |
@@ -4126,8 +4130,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
4126 | /* Make sure the RF_KILL check timer is running */ | 4130 | /* Make sure the RF_KILL check timer is running */ |
4127 | priv->stop_rf_kill = 0; | 4131 | priv->stop_rf_kill = 0; |
4128 | cancel_delayed_work(&priv->rf_kill); | 4132 | cancel_delayed_work(&priv->rf_kill); |
4129 | queue_delayed_work(priv->workqueue, &priv->rf_kill, | 4133 | queue_delayed_work(priv->workqueue, &priv->rf_kill, HZ); |
4130 | HZ); | ||
4131 | } else | 4134 | } else |
4132 | schedule_reset(priv); | 4135 | schedule_reset(priv); |
4133 | } | 4136 | } |
@@ -4137,14 +4140,14 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
4137 | } | 4140 | } |
4138 | 4141 | ||
4139 | static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, | 4142 | static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, |
4140 | const char *buf, size_t count) | 4143 | const char *buf, size_t count) |
4141 | { | 4144 | { |
4142 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4145 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4143 | ipw_radio_kill_sw(priv, buf[0] == '1'); | 4146 | ipw_radio_kill_sw(priv, buf[0] == '1'); |
4144 | return count; | 4147 | return count; |
4145 | } | 4148 | } |
4146 | static DEVICE_ATTR(rf_kill, S_IWUSR|S_IRUGO, show_rf_kill, store_rf_kill); | ||
4147 | 4149 | ||
4150 | static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); | ||
4148 | 4151 | ||
4149 | static struct attribute *ipw2100_sysfs_entries[] = { | 4152 | static struct attribute *ipw2100_sysfs_entries[] = { |
4150 | &dev_attr_hardware.attr, | 4153 | &dev_attr_hardware.attr, |
@@ -4168,7 +4171,6 @@ static struct attribute_group ipw2100_attribute_group = { | |||
4168 | .attrs = ipw2100_sysfs_entries, | 4171 | .attrs = ipw2100_sysfs_entries, |
4169 | }; | 4172 | }; |
4170 | 4173 | ||
4171 | |||
4172 | static int status_queue_allocate(struct ipw2100_priv *priv, int entries) | 4174 | static int status_queue_allocate(struct ipw2100_priv *priv, int entries) |
4173 | { | 4175 | { |
4174 | struct ipw2100_status_queue *q = &priv->status_queue; | 4176 | struct ipw2100_status_queue *q = &priv->status_queue; |
@@ -4176,11 +4178,11 @@ static int status_queue_allocate(struct ipw2100_priv *priv, int entries) | |||
4176 | IPW_DEBUG_INFO("enter\n"); | 4178 | IPW_DEBUG_INFO("enter\n"); |
4177 | 4179 | ||
4178 | q->size = entries * sizeof(struct ipw2100_status); | 4180 | q->size = entries * sizeof(struct ipw2100_status); |
4179 | q->drv = (struct ipw2100_status *)pci_alloc_consistent( | 4181 | q->drv = |
4180 | priv->pci_dev, q->size, &q->nic); | 4182 | (struct ipw2100_status *)pci_alloc_consistent(priv->pci_dev, |
4183 | q->size, &q->nic); | ||
4181 | if (!q->drv) { | 4184 | if (!q->drv) { |
4182 | IPW_DEBUG_WARNING( | 4185 | IPW_DEBUG_WARNING("Can not allocate status queue.\n"); |
4183 | "Can not allocate status queue.\n"); | ||
4184 | return -ENOMEM; | 4186 | return -ENOMEM; |
4185 | } | 4187 | } |
4186 | 4188 | ||
@@ -4196,9 +4198,9 @@ static void status_queue_free(struct ipw2100_priv *priv) | |||
4196 | IPW_DEBUG_INFO("enter\n"); | 4198 | IPW_DEBUG_INFO("enter\n"); |
4197 | 4199 | ||
4198 | if (priv->status_queue.drv) { | 4200 | if (priv->status_queue.drv) { |
4199 | pci_free_consistent( | 4201 | pci_free_consistent(priv->pci_dev, priv->status_queue.size, |
4200 | priv->pci_dev, priv->status_queue.size, | 4202 | priv->status_queue.drv, |
4201 | priv->status_queue.drv, priv->status_queue.nic); | 4203 | priv->status_queue.nic); |
4202 | priv->status_queue.drv = NULL; | 4204 | priv->status_queue.drv = NULL; |
4203 | } | 4205 | } |
4204 | 4206 | ||
@@ -4216,7 +4218,8 @@ static int bd_queue_allocate(struct ipw2100_priv *priv, | |||
4216 | q->size = entries * sizeof(struct ipw2100_bd); | 4218 | q->size = entries * sizeof(struct ipw2100_bd); |
4217 | q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); | 4219 | q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); |
4218 | if (!q->drv) { | 4220 | if (!q->drv) { |
4219 | IPW_DEBUG_INFO("can't allocate shared memory for buffer descriptors\n"); | 4221 | IPW_DEBUG_INFO |
4222 | ("can't allocate shared memory for buffer descriptors\n"); | ||
4220 | return -ENOMEM; | 4223 | return -ENOMEM; |
4221 | } | 4224 | } |
4222 | memset(q->drv, 0, q->size); | 4225 | memset(q->drv, 0, q->size); |
@@ -4226,8 +4229,7 @@ static int bd_queue_allocate(struct ipw2100_priv *priv, | |||
4226 | return 0; | 4229 | return 0; |
4227 | } | 4230 | } |
4228 | 4231 | ||
4229 | static void bd_queue_free(struct ipw2100_priv *priv, | 4232 | static void bd_queue_free(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q) |
4230 | struct ipw2100_bd_queue *q) | ||
4231 | { | 4233 | { |
4232 | IPW_DEBUG_INFO("enter\n"); | 4234 | IPW_DEBUG_INFO("enter\n"); |
4233 | 4235 | ||
@@ -4235,21 +4237,21 @@ static void bd_queue_free(struct ipw2100_priv *priv, | |||
4235 | return; | 4237 | return; |
4236 | 4238 | ||
4237 | if (q->drv) { | 4239 | if (q->drv) { |
4238 | pci_free_consistent(priv->pci_dev, | 4240 | pci_free_consistent(priv->pci_dev, q->size, q->drv, q->nic); |
4239 | q->size, q->drv, q->nic); | ||
4240 | q->drv = NULL; | 4241 | q->drv = NULL; |
4241 | } | 4242 | } |
4242 | 4243 | ||
4243 | IPW_DEBUG_INFO("exit\n"); | 4244 | IPW_DEBUG_INFO("exit\n"); |
4244 | } | 4245 | } |
4245 | 4246 | ||
4246 | static void bd_queue_initialize( | 4247 | static void bd_queue_initialize(struct ipw2100_priv *priv, |
4247 | struct ipw2100_priv *priv, struct ipw2100_bd_queue * q, | 4248 | struct ipw2100_bd_queue *q, u32 base, u32 size, |
4248 | u32 base, u32 size, u32 r, u32 w) | 4249 | u32 r, u32 w) |
4249 | { | 4250 | { |
4250 | IPW_DEBUG_INFO("enter\n"); | 4251 | IPW_DEBUG_INFO("enter\n"); |
4251 | 4252 | ||
4252 | IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, (u32)q->nic); | 4253 | IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, |
4254 | (u32) q->nic); | ||
4253 | 4255 | ||
4254 | write_register(priv->net_dev, base, q->nic); | 4256 | write_register(priv->net_dev, base, q->nic); |
4255 | write_register(priv->net_dev, size, q->entries); | 4257 | write_register(priv->net_dev, size, q->entries); |
@@ -4285,32 +4287,38 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv) | |||
4285 | err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); | 4287 | err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); |
4286 | if (err) { | 4288 | if (err) { |
4287 | IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", | 4289 | IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", |
4288 | priv->net_dev->name); | 4290 | priv->net_dev->name); |
4289 | return err; | 4291 | return err; |
4290 | } | 4292 | } |
4291 | 4293 | ||
4292 | priv->tx_buffers = (struct ipw2100_tx_packet *)kmalloc( | 4294 | priv->tx_buffers = |
4293 | TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet), | 4295 | (struct ipw2100_tx_packet *)kmalloc(TX_PENDED_QUEUE_LENGTH * |
4294 | GFP_ATOMIC); | 4296 | sizeof(struct |
4297 | ipw2100_tx_packet), | ||
4298 | GFP_ATOMIC); | ||
4295 | if (!priv->tx_buffers) { | 4299 | if (!priv->tx_buffers) { |
4296 | printk(KERN_ERR DRV_NAME ": %s: alloc failed form tx buffers.\n", | 4300 | printk(KERN_ERR DRV_NAME |
4301 | ": %s: alloc failed form tx buffers.\n", | ||
4297 | priv->net_dev->name); | 4302 | priv->net_dev->name); |
4298 | bd_queue_free(priv, &priv->tx_queue); | 4303 | bd_queue_free(priv, &priv->tx_queue); |
4299 | return -ENOMEM; | 4304 | return -ENOMEM; |
4300 | } | 4305 | } |
4301 | 4306 | ||
4302 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { | 4307 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { |
4303 | v = pci_alloc_consistent( | 4308 | v = pci_alloc_consistent(priv->pci_dev, |
4304 | priv->pci_dev, sizeof(struct ipw2100_data_header), &p); | 4309 | sizeof(struct ipw2100_data_header), |
4310 | &p); | ||
4305 | if (!v) { | 4311 | if (!v) { |
4306 | printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for tx " | 4312 | printk(KERN_ERR DRV_NAME |
4307 | "buffers.\n", priv->net_dev->name); | 4313 | ": %s: PCI alloc failed for tx " "buffers.\n", |
4314 | priv->net_dev->name); | ||
4308 | err = -ENOMEM; | 4315 | err = -ENOMEM; |
4309 | break; | 4316 | break; |
4310 | } | 4317 | } |
4311 | 4318 | ||
4312 | priv->tx_buffers[i].type = DATA; | 4319 | priv->tx_buffers[i].type = DATA; |
4313 | priv->tx_buffers[i].info.d_struct.data = (struct ipw2100_data_header*)v; | 4320 | priv->tx_buffers[i].info.d_struct.data = |
4321 | (struct ipw2100_data_header *)v; | ||
4314 | priv->tx_buffers[i].info.d_struct.data_phys = p; | 4322 | priv->tx_buffers[i].info.d_struct.data_phys = p; |
4315 | priv->tx_buffers[i].info.d_struct.txb = NULL; | 4323 | priv->tx_buffers[i].info.d_struct.txb = NULL; |
4316 | } | 4324 | } |
@@ -4319,11 +4327,11 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv) | |||
4319 | return 0; | 4327 | return 0; |
4320 | 4328 | ||
4321 | for (j = 0; j < i; j++) { | 4329 | for (j = 0; j < i; j++) { |
4322 | pci_free_consistent( | 4330 | pci_free_consistent(priv->pci_dev, |
4323 | priv->pci_dev, | 4331 | sizeof(struct ipw2100_data_header), |
4324 | sizeof(struct ipw2100_data_header), | 4332 | priv->tx_buffers[j].info.d_struct.data, |
4325 | priv->tx_buffers[j].info.d_struct.data, | 4333 | priv->tx_buffers[j].info.d_struct. |
4326 | priv->tx_buffers[j].info.d_struct.data_phys); | 4334 | data_phys); |
4327 | } | 4335 | } |
4328 | 4336 | ||
4329 | kfree(priv->tx_buffers); | 4337 | kfree(priv->tx_buffers); |
@@ -4356,7 +4364,8 @@ static void ipw2100_tx_initialize(struct ipw2100_priv *priv) | |||
4356 | /* We simply drop any SKBs that have been queued for | 4364 | /* We simply drop any SKBs that have been queued for |
4357 | * transmit */ | 4365 | * transmit */ |
4358 | if (priv->tx_buffers[i].info.d_struct.txb) { | 4366 | if (priv->tx_buffers[i].info.d_struct.txb) { |
4359 | ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.txb); | 4367 | ieee80211_txb_free(priv->tx_buffers[i].info.d_struct. |
4368 | txb); | ||
4360 | priv->tx_buffers[i].info.d_struct.txb = NULL; | 4369 | priv->tx_buffers[i].info.d_struct.txb = NULL; |
4361 | } | 4370 | } |
4362 | 4371 | ||
@@ -4394,15 +4403,17 @@ static void ipw2100_tx_free(struct ipw2100_priv *priv) | |||
4394 | 4403 | ||
4395 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { | 4404 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { |
4396 | if (priv->tx_buffers[i].info.d_struct.txb) { | 4405 | if (priv->tx_buffers[i].info.d_struct.txb) { |
4397 | ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.txb); | 4406 | ieee80211_txb_free(priv->tx_buffers[i].info.d_struct. |
4407 | txb); | ||
4398 | priv->tx_buffers[i].info.d_struct.txb = NULL; | 4408 | priv->tx_buffers[i].info.d_struct.txb = NULL; |
4399 | } | 4409 | } |
4400 | if (priv->tx_buffers[i].info.d_struct.data) | 4410 | if (priv->tx_buffers[i].info.d_struct.data) |
4401 | pci_free_consistent( | 4411 | pci_free_consistent(priv->pci_dev, |
4402 | priv->pci_dev, | 4412 | sizeof(struct ipw2100_data_header), |
4403 | sizeof(struct ipw2100_data_header), | 4413 | priv->tx_buffers[i].info.d_struct. |
4404 | priv->tx_buffers[i].info.d_struct.data, | 4414 | data, |
4405 | priv->tx_buffers[i].info.d_struct.data_phys); | 4415 | priv->tx_buffers[i].info.d_struct. |
4416 | data_phys); | ||
4406 | } | 4417 | } |
4407 | 4418 | ||
4408 | kfree(priv->tx_buffers); | 4419 | kfree(priv->tx_buffers); |
@@ -4411,8 +4422,6 @@ static void ipw2100_tx_free(struct ipw2100_priv *priv) | |||
4411 | IPW_DEBUG_INFO("exit\n"); | 4422 | IPW_DEBUG_INFO("exit\n"); |
4412 | } | 4423 | } |
4413 | 4424 | ||
4414 | |||
4415 | |||
4416 | static int ipw2100_rx_allocate(struct ipw2100_priv *priv) | 4425 | static int ipw2100_rx_allocate(struct ipw2100_priv *priv) |
4417 | { | 4426 | { |
4418 | int i, j, err = -EINVAL; | 4427 | int i, j, err = -EINVAL; |
@@ -4542,14 +4551,13 @@ static int ipw2100_read_mac_address(struct ipw2100_priv *priv) | |||
4542 | 4551 | ||
4543 | int err; | 4552 | int err; |
4544 | 4553 | ||
4545 | err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, | 4554 | err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, mac, &length); |
4546 | mac, &length); | ||
4547 | if (err) { | 4555 | if (err) { |
4548 | IPW_DEBUG_INFO("MAC address read failed\n"); | 4556 | IPW_DEBUG_INFO("MAC address read failed\n"); |
4549 | return -EIO; | 4557 | return -EIO; |
4550 | } | 4558 | } |
4551 | IPW_DEBUG_INFO("card MAC is %02X:%02X:%02X:%02X:%02X:%02X\n", | 4559 | IPW_DEBUG_INFO("card MAC is %02X:%02X:%02X:%02X:%02X:%02X\n", |
4552 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); | 4560 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); |
4553 | 4561 | ||
4554 | memcpy(priv->net_dev->dev_addr, mac, ETH_ALEN); | 4562 | memcpy(priv->net_dev->dev_addr, mac, ETH_ALEN); |
4555 | 4563 | ||
@@ -4576,8 +4584,7 @@ static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode) | |||
4576 | IPW_DEBUG_INFO("enter\n"); | 4584 | IPW_DEBUG_INFO("enter\n"); |
4577 | 4585 | ||
4578 | if (priv->config & CFG_CUSTOM_MAC) { | 4586 | if (priv->config & CFG_CUSTOM_MAC) { |
4579 | memcpy(cmd.host_command_parameters, priv->mac_addr, | 4587 | memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN); |
4580 | ETH_ALEN); | ||
4581 | memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); | 4588 | memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); |
4582 | } else | 4589 | } else |
4583 | memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, | 4590 | memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, |
@@ -4614,7 +4621,8 @@ static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, | |||
4614 | if (!batch_mode) { | 4621 | if (!batch_mode) { |
4615 | err = ipw2100_disable_adapter(priv); | 4622 | err = ipw2100_disable_adapter(priv); |
4616 | if (err) { | 4623 | if (err) { |
4617 | printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", | 4624 | printk(KERN_ERR DRV_NAME |
4625 | ": %s: Could not disable adapter %d\n", | ||
4618 | priv->net_dev->name, err); | 4626 | priv->net_dev->name, err); |
4619 | return err; | 4627 | return err; |
4620 | } | 4628 | } |
@@ -4629,7 +4637,6 @@ static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, | |||
4629 | return err; | 4637 | return err; |
4630 | } | 4638 | } |
4631 | 4639 | ||
4632 | |||
4633 | static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, | 4640 | static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, |
4634 | int batch_mode) | 4641 | int batch_mode) |
4635 | { | 4642 | { |
@@ -4660,8 +4667,7 @@ static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, | |||
4660 | 4667 | ||
4661 | err = ipw2100_hw_send_command(priv, &cmd); | 4668 | err = ipw2100_hw_send_command(priv, &cmd); |
4662 | if (err) { | 4669 | if (err) { |
4663 | IPW_DEBUG_INFO("Failed to set channel to %d", | 4670 | IPW_DEBUG_INFO("Failed to set channel to %d", channel); |
4664 | channel); | ||
4665 | return err; | 4671 | return err; |
4666 | } | 4672 | } |
4667 | 4673 | ||
@@ -4703,15 +4709,14 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) | |||
4703 | cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; | 4709 | cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; |
4704 | 4710 | ||
4705 | cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | | 4711 | cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | |
4706 | IPW_CFG_BSS_MASK | | 4712 | IPW_CFG_BSS_MASK | IPW_CFG_802_1x_ENABLE; |
4707 | IPW_CFG_802_1x_ENABLE; | ||
4708 | 4713 | ||
4709 | if (!(priv->config & CFG_LONG_PREAMBLE)) | 4714 | if (!(priv->config & CFG_LONG_PREAMBLE)) |
4710 | cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; | 4715 | cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; |
4711 | 4716 | ||
4712 | err = ipw2100_get_ordinal(priv, | 4717 | err = ipw2100_get_ordinal(priv, |
4713 | IPW_ORD_EEPROM_IBSS_11B_CHANNELS, | 4718 | IPW_ORD_EEPROM_IBSS_11B_CHANNELS, |
4714 | &ibss_mask, &len); | 4719 | &ibss_mask, &len); |
4715 | if (err) | 4720 | if (err) |
4716 | ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; | 4721 | ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; |
4717 | 4722 | ||
@@ -4719,7 +4724,7 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) | |||
4719 | cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; | 4724 | cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; |
4720 | 4725 | ||
4721 | /* 11b only */ | 4726 | /* 11b only */ |
4722 | /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A;*/ | 4727 | /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A; */ |
4723 | 4728 | ||
4724 | err = ipw2100_hw_send_command(priv, &cmd); | 4729 | err = ipw2100_hw_send_command(priv, &cmd); |
4725 | if (err) | 4730 | if (err) |
@@ -4783,8 +4788,7 @@ static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, | |||
4783 | return 0; | 4788 | return 0; |
4784 | } | 4789 | } |
4785 | 4790 | ||
4786 | static int ipw2100_set_power_mode(struct ipw2100_priv *priv, | 4791 | static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level) |
4787 | int power_level) | ||
4788 | { | 4792 | { |
4789 | struct host_command cmd = { | 4793 | struct host_command cmd = { |
4790 | .host_command = POWER_MODE, | 4794 | .host_command = POWER_MODE, |
@@ -4805,11 +4809,10 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, | |||
4805 | priv->power_mode = IPW_POWER_ENABLED | power_level; | 4809 | priv->power_mode = IPW_POWER_ENABLED | power_level; |
4806 | 4810 | ||
4807 | #ifdef CONFIG_IPW2100_TX_POWER | 4811 | #ifdef CONFIG_IPW2100_TX_POWER |
4808 | if (priv->port_type == IBSS && | 4812 | if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { |
4809 | priv->adhoc_power != DFTL_IBSS_TX_POWER) { | ||
4810 | /* Set beacon interval */ | 4813 | /* Set beacon interval */ |
4811 | cmd.host_command = TX_POWER_INDEX; | 4814 | cmd.host_command = TX_POWER_INDEX; |
4812 | cmd.host_command_parameters[0] = (u32)priv->adhoc_power; | 4815 | cmd.host_command_parameters[0] = (u32) priv->adhoc_power; |
4813 | 4816 | ||
4814 | err = ipw2100_hw_send_command(priv, &cmd); | 4817 | err = ipw2100_hw_send_command(priv, &cmd); |
4815 | if (err) | 4818 | if (err) |
@@ -4820,7 +4823,6 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, | |||
4820 | return 0; | 4823 | return 0; |
4821 | } | 4824 | } |
4822 | 4825 | ||
4823 | |||
4824 | static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) | 4826 | static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) |
4825 | { | 4827 | { |
4826 | struct host_command cmd = { | 4828 | struct host_command cmd = { |
@@ -4925,8 +4927,7 @@ static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry) | |||
4925 | return 0; | 4927 | return 0; |
4926 | } | 4928 | } |
4927 | 4929 | ||
4928 | 4930 | static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid, | |
4929 | static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, | ||
4930 | int batch_mode) | 4931 | int batch_mode) |
4931 | { | 4932 | { |
4932 | struct host_command cmd = { | 4933 | struct host_command cmd = { |
@@ -4938,16 +4939,15 @@ static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, | |||
4938 | 4939 | ||
4939 | #ifdef CONFIG_IPW_DEBUG | 4940 | #ifdef CONFIG_IPW_DEBUG |
4940 | if (bssid != NULL) | 4941 | if (bssid != NULL) |
4941 | IPW_DEBUG_HC( | 4942 | IPW_DEBUG_HC("MANDATORY_BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n", |
4942 | "MANDATORY_BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n", | 4943 | bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], |
4943 | bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], | 4944 | bssid[5]); |
4944 | bssid[5]); | ||
4945 | else | 4945 | else |
4946 | IPW_DEBUG_HC("MANDATORY_BSSID: <clear>\n"); | 4946 | IPW_DEBUG_HC("MANDATORY_BSSID: <clear>\n"); |
4947 | #endif | 4947 | #endif |
4948 | /* if BSSID is empty then we disable mandatory bssid mode */ | 4948 | /* if BSSID is empty then we disable mandatory bssid mode */ |
4949 | if (bssid != NULL) | 4949 | if (bssid != NULL) |
4950 | memcpy((u8 *)cmd.host_command_parameters, bssid, ETH_ALEN); | 4950 | memcpy(cmd.host_command_parameters, bssid, ETH_ALEN); |
4951 | 4951 | ||
4952 | if (!batch_mode) { | 4952 | if (!batch_mode) { |
4953 | err = ipw2100_disable_adapter(priv); | 4953 | err = ipw2100_disable_adapter(priv); |
@@ -4963,7 +4963,6 @@ static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, | |||
4963 | return err; | 4963 | return err; |
4964 | } | 4964 | } |
4965 | 4965 | ||
4966 | #ifdef CONFIG_IEEE80211_WPA | ||
4967 | static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) | 4966 | static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) |
4968 | { | 4967 | { |
4969 | struct host_command cmd = { | 4968 | struct host_command cmd = { |
@@ -4987,42 +4986,10 @@ static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) | |||
4987 | 4986 | ||
4988 | return err; | 4987 | return err; |
4989 | } | 4988 | } |
4990 | #endif | ||
4991 | |||
4992 | /* | ||
4993 | * Pseudo code for setting up wpa_frame: | ||
4994 | */ | ||
4995 | #if 0 | ||
4996 | void x(struct ieee80211_assoc_frame *wpa_assoc) | ||
4997 | { | ||
4998 | struct ipw2100_wpa_assoc_frame frame; | ||
4999 | frame->fixed_ie_mask = IPW_WPA_CAPABILTIES | | ||
5000 | IPW_WPA_LISTENINTERVAL | | ||
5001 | IPW_WPA_AP_ADDRESS; | ||
5002 | frame->capab_info = wpa_assoc->capab_info; | ||
5003 | frame->lisen_interval = wpa_assoc->listent_interval; | ||
5004 | memcpy(frame->current_ap, wpa_assoc->current_ap, ETH_ALEN); | ||
5005 | |||
5006 | /* UNKNOWN -- I'm not postivive about this part; don't have any WPA | ||
5007 | * setup here to test it with. | ||
5008 | * | ||
5009 | * Walk the IEs in the wpa_assoc and figure out the total size of all | ||
5010 | * that data. Stick that into frame->var_ie_len. Then memcpy() all of | ||
5011 | * the IEs from wpa_frame into frame. | ||
5012 | */ | ||
5013 | frame->var_ie_len = calculate_ie_len(wpa_assoc); | ||
5014 | memcpy(frame->var_ie, wpa_assoc->variable, frame->var_ie_len); | ||
5015 | |||
5016 | ipw2100_set_wpa_ie(priv, &frame, 0); | ||
5017 | } | ||
5018 | #endif | ||
5019 | |||
5020 | |||
5021 | |||
5022 | 4989 | ||
5023 | static int ipw2100_set_wpa_ie(struct ipw2100_priv *, | 4990 | static int ipw2100_set_wpa_ie(struct ipw2100_priv *, |
5024 | struct ipw2100_wpa_assoc_frame *, int) | 4991 | struct ipw2100_wpa_assoc_frame *, int) |
5025 | __attribute__ ((unused)); | 4992 | __attribute__ ((unused)); |
5026 | 4993 | ||
5027 | static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, | 4994 | static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, |
5028 | struct ipw2100_wpa_assoc_frame *wpa_frame, | 4995 | struct ipw2100_wpa_assoc_frame *wpa_frame, |
@@ -5076,7 +5043,7 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, | |||
5076 | .host_command_length = sizeof(struct security_info_params) | 5043 | .host_command_length = sizeof(struct security_info_params) |
5077 | }; | 5044 | }; |
5078 | struct security_info_params *security = | 5045 | struct security_info_params *security = |
5079 | (struct security_info_params *)&cmd.host_command_parameters; | 5046 | (struct security_info_params *)&cmd.host_command_parameters; |
5080 | int err; | 5047 | int err; |
5081 | memset(security, 0, sizeof(*security)); | 5048 | memset(security, 0, sizeof(*security)); |
5082 | 5049 | ||
@@ -5094,25 +5061,25 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, | |||
5094 | break; | 5061 | break; |
5095 | case SEC_LEVEL_1: | 5062 | case SEC_LEVEL_1: |
5096 | security->allowed_ciphers = IPW_WEP40_CIPHER | | 5063 | security->allowed_ciphers = IPW_WEP40_CIPHER | |
5097 | IPW_WEP104_CIPHER; | 5064 | IPW_WEP104_CIPHER; |
5098 | break; | 5065 | break; |
5099 | case SEC_LEVEL_2: | 5066 | case SEC_LEVEL_2: |
5100 | security->allowed_ciphers = IPW_WEP40_CIPHER | | 5067 | security->allowed_ciphers = IPW_WEP40_CIPHER | |
5101 | IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; | 5068 | IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; |
5102 | break; | 5069 | break; |
5103 | case SEC_LEVEL_2_CKIP: | 5070 | case SEC_LEVEL_2_CKIP: |
5104 | security->allowed_ciphers = IPW_WEP40_CIPHER | | 5071 | security->allowed_ciphers = IPW_WEP40_CIPHER | |
5105 | IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; | 5072 | IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; |
5106 | break; | 5073 | break; |
5107 | case SEC_LEVEL_3: | 5074 | case SEC_LEVEL_3: |
5108 | security->allowed_ciphers = IPW_WEP40_CIPHER | | 5075 | security->allowed_ciphers = IPW_WEP40_CIPHER | |
5109 | IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; | 5076 | IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; |
5110 | break; | 5077 | break; |
5111 | } | 5078 | } |
5112 | 5079 | ||
5113 | IPW_DEBUG_HC( | 5080 | IPW_DEBUG_HC |
5114 | "SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", | 5081 | ("SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", |
5115 | security->auth_mode, security->allowed_ciphers, security_level); | 5082 | security->auth_mode, security->allowed_ciphers, security_level); |
5116 | 5083 | ||
5117 | security->replay_counters_number = 0; | 5084 | security->replay_counters_number = 0; |
5118 | 5085 | ||
@@ -5130,8 +5097,7 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, | |||
5130 | return err; | 5097 | return err; |
5131 | } | 5098 | } |
5132 | 5099 | ||
5133 | static int ipw2100_set_tx_power(struct ipw2100_priv *priv, | 5100 | static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) |
5134 | u32 tx_power) | ||
5135 | { | 5101 | { |
5136 | struct host_command cmd = { | 5102 | struct host_command cmd = { |
5137 | .host_command = TX_POWER_INDEX, | 5103 | .host_command = TX_POWER_INDEX, |
@@ -5140,6 +5106,10 @@ static int ipw2100_set_tx_power(struct ipw2100_priv *priv, | |||
5140 | }; | 5106 | }; |
5141 | int err = 0; | 5107 | int err = 0; |
5142 | 5108 | ||
5109 | if (tx_power != IPW_TX_POWER_DEFAULT) | ||
5110 | tx_power = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / | ||
5111 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); | ||
5112 | |||
5143 | cmd.host_command_parameters[0] = tx_power; | 5113 | cmd.host_command_parameters[0] = tx_power; |
5144 | 5114 | ||
5145 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | 5115 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) |
@@ -5185,7 +5155,6 @@ static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv, | |||
5185 | return 0; | 5155 | return 0; |
5186 | } | 5156 | } |
5187 | 5157 | ||
5188 | |||
5189 | void ipw2100_queues_initialize(struct ipw2100_priv *priv) | 5158 | void ipw2100_queues_initialize(struct ipw2100_priv *priv) |
5190 | { | 5159 | { |
5191 | ipw2100_tx_initialize(priv); | 5160 | ipw2100_tx_initialize(priv); |
@@ -5203,13 +5172,12 @@ void ipw2100_queues_free(struct ipw2100_priv *priv) | |||
5203 | int ipw2100_queues_allocate(struct ipw2100_priv *priv) | 5172 | int ipw2100_queues_allocate(struct ipw2100_priv *priv) |
5204 | { | 5173 | { |
5205 | if (ipw2100_tx_allocate(priv) || | 5174 | if (ipw2100_tx_allocate(priv) || |
5206 | ipw2100_rx_allocate(priv) || | 5175 | ipw2100_rx_allocate(priv) || ipw2100_msg_allocate(priv)) |
5207 | ipw2100_msg_allocate(priv)) | ||
5208 | goto fail; | 5176 | goto fail; |
5209 | 5177 | ||
5210 | return 0; | 5178 | return 0; |
5211 | 5179 | ||
5212 | fail: | 5180 | fail: |
5213 | ipw2100_tx_free(priv); | 5181 | ipw2100_tx_free(priv); |
5214 | ipw2100_rx_free(priv); | 5182 | ipw2100_rx_free(priv); |
5215 | ipw2100_msg_free(priv); | 5183 | ipw2100_msg_free(priv); |
@@ -5235,7 +5203,8 @@ static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags, | |||
5235 | if (!batch_mode) { | 5203 | if (!batch_mode) { |
5236 | err = ipw2100_disable_adapter(priv); | 5204 | err = ipw2100_disable_adapter(priv); |
5237 | if (err) { | 5205 | if (err) { |
5238 | printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", | 5206 | printk(KERN_ERR DRV_NAME |
5207 | ": %s: Could not disable adapter %d\n", | ||
5239 | priv->net_dev->name, err); | 5208 | priv->net_dev->name, err); |
5240 | return err; | 5209 | return err; |
5241 | } | 5210 | } |
@@ -5262,7 +5231,6 @@ struct ipw2100_wep_key { | |||
5262 | #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] | 5231 | #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] |
5263 | #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] | 5232 | #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] |
5264 | 5233 | ||
5265 | |||
5266 | /** | 5234 | /** |
5267 | * Set a the wep key | 5235 | * Set a the wep key |
5268 | * | 5236 | * |
@@ -5287,11 +5255,11 @@ static int ipw2100_set_key(struct ipw2100_priv *priv, | |||
5287 | .host_command_sequence = 0, | 5255 | .host_command_sequence = 0, |
5288 | .host_command_length = sizeof(struct ipw2100_wep_key), | 5256 | .host_command_length = sizeof(struct ipw2100_wep_key), |
5289 | }; | 5257 | }; |
5290 | struct ipw2100_wep_key *wep_key = (void*)cmd.host_command_parameters; | 5258 | struct ipw2100_wep_key *wep_key = (void *)cmd.host_command_parameters; |
5291 | int err; | 5259 | int err; |
5292 | 5260 | ||
5293 | IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", | 5261 | IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", |
5294 | idx, keylen, len); | 5262 | idx, keylen, len); |
5295 | 5263 | ||
5296 | /* NOTE: We don't check cached values in case the firmware was reset | 5264 | /* NOTE: We don't check cached values in case the firmware was reset |
5297 | * or some other problem is occuring. If the user is setting the key, | 5265 | * or some other problem is occuring. If the user is setting the key, |
@@ -5308,22 +5276,23 @@ static int ipw2100_set_key(struct ipw2100_priv *priv, | |||
5308 | /* Will be optimized out on debug not being configured in */ | 5276 | /* Will be optimized out on debug not being configured in */ |
5309 | if (keylen == 0) | 5277 | if (keylen == 0) |
5310 | IPW_DEBUG_WEP("%s: Clearing key %d\n", | 5278 | IPW_DEBUG_WEP("%s: Clearing key %d\n", |
5311 | priv->net_dev->name, wep_key->idx); | 5279 | priv->net_dev->name, wep_key->idx); |
5312 | else if (keylen == 5) | 5280 | else if (keylen == 5) |
5313 | IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", | 5281 | IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", |
5314 | priv->net_dev->name, wep_key->idx, wep_key->len, | 5282 | priv->net_dev->name, wep_key->idx, wep_key->len, |
5315 | WEP_STR_64(wep_key->key)); | 5283 | WEP_STR_64(wep_key->key)); |
5316 | else | 5284 | else |
5317 | IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 | 5285 | IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 |
5318 | "\n", | 5286 | "\n", |
5319 | priv->net_dev->name, wep_key->idx, wep_key->len, | 5287 | priv->net_dev->name, wep_key->idx, wep_key->len, |
5320 | WEP_STR_128(wep_key->key)); | 5288 | WEP_STR_128(wep_key->key)); |
5321 | 5289 | ||
5322 | if (!batch_mode) { | 5290 | if (!batch_mode) { |
5323 | err = ipw2100_disable_adapter(priv); | 5291 | err = ipw2100_disable_adapter(priv); |
5324 | /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ | 5292 | /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ |
5325 | if (err) { | 5293 | if (err) { |
5326 | printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", | 5294 | printk(KERN_ERR DRV_NAME |
5295 | ": %s: Could not disable adapter %d\n", | ||
5327 | priv->net_dev->name, err); | 5296 | priv->net_dev->name, err); |
5328 | return err; | 5297 | return err; |
5329 | } | 5298 | } |
@@ -5347,7 +5316,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, | |||
5347 | .host_command = WEP_KEY_INDEX, | 5316 | .host_command = WEP_KEY_INDEX, |
5348 | .host_command_sequence = 0, | 5317 | .host_command_sequence = 0, |
5349 | .host_command_length = 4, | 5318 | .host_command_length = 4, |
5350 | .host_command_parameters = { idx }, | 5319 | .host_command_parameters = {idx}, |
5351 | }; | 5320 | }; |
5352 | int err; | 5321 | int err; |
5353 | 5322 | ||
@@ -5359,7 +5328,8 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, | |||
5359 | if (!batch_mode) { | 5328 | if (!batch_mode) { |
5360 | err = ipw2100_disable_adapter(priv); | 5329 | err = ipw2100_disable_adapter(priv); |
5361 | if (err) { | 5330 | if (err) { |
5362 | printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", | 5331 | printk(KERN_ERR DRV_NAME |
5332 | ": %s: Could not disable adapter %d\n", | ||
5363 | priv->net_dev->name, err); | 5333 | priv->net_dev->name, err); |
5364 | return err; | 5334 | return err; |
5365 | } | 5335 | } |
@@ -5374,9 +5344,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, | |||
5374 | return err; | 5344 | return err; |
5375 | } | 5345 | } |
5376 | 5346 | ||
5377 | 5347 | static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) | |
5378 | static int ipw2100_configure_security(struct ipw2100_priv *priv, | ||
5379 | int batch_mode) | ||
5380 | { | 5348 | { |
5381 | int i, err, auth_mode, sec_level, use_group; | 5349 | int i, err, auth_mode, sec_level, use_group; |
5382 | 5350 | ||
@@ -5389,40 +5357,42 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, | |||
5389 | return err; | 5357 | return err; |
5390 | } | 5358 | } |
5391 | 5359 | ||
5392 | if (!priv->sec.enabled) { | 5360 | if (!priv->ieee->sec.enabled) { |
5393 | err = ipw2100_set_security_information( | 5361 | err = |
5394 | priv, IPW_AUTH_OPEN, SEC_LEVEL_0, 0, 1); | 5362 | ipw2100_set_security_information(priv, IPW_AUTH_OPEN, |
5363 | SEC_LEVEL_0, 0, 1); | ||
5395 | } else { | 5364 | } else { |
5396 | auth_mode = IPW_AUTH_OPEN; | 5365 | auth_mode = IPW_AUTH_OPEN; |
5397 | if ((priv->sec.flags & SEC_AUTH_MODE) && | 5366 | if ((priv->ieee->sec.flags & SEC_AUTH_MODE) && |
5398 | (priv->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) | 5367 | (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) |
5399 | auth_mode = IPW_AUTH_SHARED; | 5368 | auth_mode = IPW_AUTH_SHARED; |
5400 | 5369 | ||
5401 | sec_level = SEC_LEVEL_0; | 5370 | sec_level = SEC_LEVEL_0; |
5402 | if (priv->sec.flags & SEC_LEVEL) | 5371 | if (priv->ieee->sec.flags & SEC_LEVEL) |
5403 | sec_level = priv->sec.level; | 5372 | sec_level = priv->ieee->sec.level; |
5404 | 5373 | ||
5405 | use_group = 0; | 5374 | use_group = 0; |
5406 | if (priv->sec.flags & SEC_UNICAST_GROUP) | 5375 | if (priv->ieee->sec.flags & SEC_UNICAST_GROUP) |
5407 | use_group = priv->sec.unicast_uses_group; | 5376 | use_group = priv->ieee->sec.unicast_uses_group; |
5408 | 5377 | ||
5409 | err = ipw2100_set_security_information( | 5378 | err = |
5410 | priv, auth_mode, sec_level, use_group, 1); | 5379 | ipw2100_set_security_information(priv, auth_mode, sec_level, |
5380 | use_group, 1); | ||
5411 | } | 5381 | } |
5412 | 5382 | ||
5413 | if (err) | 5383 | if (err) |
5414 | goto exit; | 5384 | goto exit; |
5415 | 5385 | ||
5416 | if (priv->sec.enabled) { | 5386 | if (priv->ieee->sec.enabled) { |
5417 | for (i = 0; i < 4; i++) { | 5387 | for (i = 0; i < 4; i++) { |
5418 | if (!(priv->sec.flags & (1 << i))) { | 5388 | if (!(priv->ieee->sec.flags & (1 << i))) { |
5419 | memset(priv->sec.keys[i], 0, WEP_KEY_LEN); | 5389 | memset(priv->ieee->sec.keys[i], 0, WEP_KEY_LEN); |
5420 | priv->sec.key_sizes[i] = 0; | 5390 | priv->ieee->sec.key_sizes[i] = 0; |
5421 | } else { | 5391 | } else { |
5422 | err = ipw2100_set_key(priv, i, | 5392 | err = ipw2100_set_key(priv, i, |
5423 | priv->sec.keys[i], | 5393 | priv->ieee->sec.keys[i], |
5424 | priv->sec.key_sizes[i], | 5394 | priv->ieee->sec. |
5425 | 1); | 5395 | key_sizes[i], 1); |
5426 | if (err) | 5396 | if (err) |
5427 | goto exit; | 5397 | goto exit; |
5428 | } | 5398 | } |
@@ -5433,14 +5403,16 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, | |||
5433 | 5403 | ||
5434 | /* Always enable privacy so the Host can filter WEP packets if | 5404 | /* Always enable privacy so the Host can filter WEP packets if |
5435 | * encrypted data is sent up */ | 5405 | * encrypted data is sent up */ |
5436 | err = ipw2100_set_wep_flags( | 5406 | err = |
5437 | priv, priv->sec.enabled ? IPW_PRIVACY_CAPABLE : 0, 1); | 5407 | ipw2100_set_wep_flags(priv, |
5408 | priv->ieee->sec. | ||
5409 | enabled ? IPW_PRIVACY_CAPABLE : 0, 1); | ||
5438 | if (err) | 5410 | if (err) |
5439 | goto exit; | 5411 | goto exit; |
5440 | 5412 | ||
5441 | priv->status &= ~STATUS_SECURITY_UPDATED; | 5413 | priv->status &= ~STATUS_SECURITY_UPDATED; |
5442 | 5414 | ||
5443 | exit: | 5415 | exit: |
5444 | if (!batch_mode) | 5416 | if (!batch_mode) |
5445 | ipw2100_enable_adapter(priv); | 5417 | ipw2100_enable_adapter(priv); |
5446 | 5418 | ||
@@ -5469,60 +5441,64 @@ static void shim__set_security(struct net_device *dev, | |||
5469 | 5441 | ||
5470 | for (i = 0; i < 4; i++) { | 5442 | for (i = 0; i < 4; i++) { |
5471 | if (sec->flags & (1 << i)) { | 5443 | if (sec->flags & (1 << i)) { |
5472 | priv->sec.key_sizes[i] = sec->key_sizes[i]; | 5444 | priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; |
5473 | if (sec->key_sizes[i] == 0) | 5445 | if (sec->key_sizes[i] == 0) |
5474 | priv->sec.flags &= ~(1 << i); | 5446 | priv->ieee->sec.flags &= ~(1 << i); |
5475 | else | 5447 | else |
5476 | memcpy(priv->sec.keys[i], sec->keys[i], | 5448 | memcpy(priv->ieee->sec.keys[i], sec->keys[i], |
5477 | sec->key_sizes[i]); | 5449 | sec->key_sizes[i]); |
5478 | priv->sec.flags |= (1 << i); | 5450 | if (sec->level == SEC_LEVEL_1) { |
5479 | priv->status |= STATUS_SECURITY_UPDATED; | 5451 | priv->ieee->sec.flags |= (1 << i); |
5452 | priv->status |= STATUS_SECURITY_UPDATED; | ||
5453 | } else | ||
5454 | priv->ieee->sec.flags &= ~(1 << i); | ||
5480 | } | 5455 | } |
5481 | } | 5456 | } |
5482 | 5457 | ||
5483 | if ((sec->flags & SEC_ACTIVE_KEY) && | 5458 | if ((sec->flags & SEC_ACTIVE_KEY) && |
5484 | priv->sec.active_key != sec->active_key) { | 5459 | priv->ieee->sec.active_key != sec->active_key) { |
5485 | if (sec->active_key <= 3) { | 5460 | if (sec->active_key <= 3) { |
5486 | priv->sec.active_key = sec->active_key; | 5461 | priv->ieee->sec.active_key = sec->active_key; |
5487 | priv->sec.flags |= SEC_ACTIVE_KEY; | 5462 | priv->ieee->sec.flags |= SEC_ACTIVE_KEY; |
5488 | } else | 5463 | } else |
5489 | priv->sec.flags &= ~SEC_ACTIVE_KEY; | 5464 | priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; |
5490 | 5465 | ||
5491 | priv->status |= STATUS_SECURITY_UPDATED; | 5466 | priv->status |= STATUS_SECURITY_UPDATED; |
5492 | } | 5467 | } |
5493 | 5468 | ||
5494 | if ((sec->flags & SEC_AUTH_MODE) && | 5469 | if ((sec->flags & SEC_AUTH_MODE) && |
5495 | (priv->sec.auth_mode != sec->auth_mode)) { | 5470 | (priv->ieee->sec.auth_mode != sec->auth_mode)) { |
5496 | priv->sec.auth_mode = sec->auth_mode; | 5471 | priv->ieee->sec.auth_mode = sec->auth_mode; |
5497 | priv->sec.flags |= SEC_AUTH_MODE; | 5472 | priv->ieee->sec.flags |= SEC_AUTH_MODE; |
5498 | priv->status |= STATUS_SECURITY_UPDATED; | 5473 | priv->status |= STATUS_SECURITY_UPDATED; |
5499 | } | 5474 | } |
5500 | 5475 | ||
5501 | if (sec->flags & SEC_ENABLED && | 5476 | if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { |
5502 | priv->sec.enabled != sec->enabled) { | 5477 | priv->ieee->sec.flags |= SEC_ENABLED; |
5503 | priv->sec.flags |= SEC_ENABLED; | 5478 | priv->ieee->sec.enabled = sec->enabled; |
5504 | priv->sec.enabled = sec->enabled; | ||
5505 | priv->status |= STATUS_SECURITY_UPDATED; | 5479 | priv->status |= STATUS_SECURITY_UPDATED; |
5506 | force_update = 1; | 5480 | force_update = 1; |
5507 | } | 5481 | } |
5508 | 5482 | ||
5509 | if (sec->flags & SEC_LEVEL && | 5483 | if (sec->flags & SEC_ENCRYPT) |
5510 | priv->sec.level != sec->level) { | 5484 | priv->ieee->sec.encrypt = sec->encrypt; |
5511 | priv->sec.level = sec->level; | 5485 | |
5512 | priv->sec.flags |= SEC_LEVEL; | 5486 | if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { |
5487 | priv->ieee->sec.level = sec->level; | ||
5488 | priv->ieee->sec.flags |= SEC_LEVEL; | ||
5513 | priv->status |= STATUS_SECURITY_UPDATED; | 5489 | priv->status |= STATUS_SECURITY_UPDATED; |
5514 | } | 5490 | } |
5515 | 5491 | ||
5516 | IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", | 5492 | IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", |
5517 | priv->sec.flags & (1<<8) ? '1' : '0', | 5493 | priv->ieee->sec.flags & (1 << 8) ? '1' : '0', |
5518 | priv->sec.flags & (1<<7) ? '1' : '0', | 5494 | priv->ieee->sec.flags & (1 << 7) ? '1' : '0', |
5519 | priv->sec.flags & (1<<6) ? '1' : '0', | 5495 | priv->ieee->sec.flags & (1 << 6) ? '1' : '0', |
5520 | priv->sec.flags & (1<<5) ? '1' : '0', | 5496 | priv->ieee->sec.flags & (1 << 5) ? '1' : '0', |
5521 | priv->sec.flags & (1<<4) ? '1' : '0', | 5497 | priv->ieee->sec.flags & (1 << 4) ? '1' : '0', |
5522 | priv->sec.flags & (1<<3) ? '1' : '0', | 5498 | priv->ieee->sec.flags & (1 << 3) ? '1' : '0', |
5523 | priv->sec.flags & (1<<2) ? '1' : '0', | 5499 | priv->ieee->sec.flags & (1 << 2) ? '1' : '0', |
5524 | priv->sec.flags & (1<<1) ? '1' : '0', | 5500 | priv->ieee->sec.flags & (1 << 1) ? '1' : '0', |
5525 | priv->sec.flags & (1<<0) ? '1' : '0'); | 5501 | priv->ieee->sec.flags & (1 << 0) ? '1' : '0'); |
5526 | 5502 | ||
5527 | /* As a temporary work around to enable WPA until we figure out why | 5503 | /* As a temporary work around to enable WPA until we figure out why |
5528 | * wpa_supplicant toggles the security capability of the driver, which | 5504 | * wpa_supplicant toggles the security capability of the driver, which |
@@ -5531,7 +5507,7 @@ static void shim__set_security(struct net_device *dev, | |||
5531 | * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ | 5507 | * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ |
5532 | if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) | 5508 | if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) |
5533 | ipw2100_configure_security(priv, 0); | 5509 | ipw2100_configure_security(priv, 0); |
5534 | done: | 5510 | done: |
5535 | up(&priv->action_sem); | 5511 | up(&priv->action_sem); |
5536 | } | 5512 | } |
5537 | 5513 | ||
@@ -5556,7 +5532,7 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | |||
5556 | 5532 | ||
5557 | return 0; | 5533 | return 0; |
5558 | } | 5534 | } |
5559 | #endif /* CONFIG_IPW2100_MONITOR */ | 5535 | #endif /* CONFIG_IPW2100_MONITOR */ |
5560 | 5536 | ||
5561 | err = ipw2100_read_mac_address(priv); | 5537 | err = ipw2100_read_mac_address(priv); |
5562 | if (err) | 5538 | if (err) |
@@ -5576,7 +5552,7 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | |||
5576 | return err; | 5552 | return err; |
5577 | } | 5553 | } |
5578 | 5554 | ||
5579 | err = ipw2100_system_config(priv, batch_mode); | 5555 | err = ipw2100_system_config(priv, batch_mode); |
5580 | if (err) | 5556 | if (err) |
5581 | return err; | 5557 | return err; |
5582 | 5558 | ||
@@ -5614,8 +5590,10 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | |||
5614 | return err; | 5590 | return err; |
5615 | 5591 | ||
5616 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | 5592 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
5617 | err = ipw2100_set_ibss_beacon_interval( | 5593 | err = |
5618 | priv, priv->beacon_interval, batch_mode); | 5594 | ipw2100_set_ibss_beacon_interval(priv, |
5595 | priv->beacon_interval, | ||
5596 | batch_mode); | ||
5619 | if (err) | 5597 | if (err) |
5620 | return err; | 5598 | return err; |
5621 | 5599 | ||
@@ -5625,18 +5603,17 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | |||
5625 | } | 5603 | } |
5626 | 5604 | ||
5627 | /* | 5605 | /* |
5628 | err = ipw2100_set_fragmentation_threshold( | 5606 | err = ipw2100_set_fragmentation_threshold( |
5629 | priv, priv->frag_threshold, batch_mode); | 5607 | priv, priv->frag_threshold, batch_mode); |
5630 | if (err) | 5608 | if (err) |
5631 | return err; | 5609 | return err; |
5632 | */ | 5610 | */ |
5633 | 5611 | ||
5634 | IPW_DEBUG_INFO("exit\n"); | 5612 | IPW_DEBUG_INFO("exit\n"); |
5635 | 5613 | ||
5636 | return 0; | 5614 | return 0; |
5637 | } | 5615 | } |
5638 | 5616 | ||
5639 | |||
5640 | /************************************************************************* | 5617 | /************************************************************************* |
5641 | * | 5618 | * |
5642 | * EXTERNALLY CALLED METHODS | 5619 | * EXTERNALLY CALLED METHODS |
@@ -5669,7 +5646,7 @@ static int ipw2100_set_address(struct net_device *dev, void *p) | |||
5669 | ipw2100_reset_adapter(priv); | 5646 | ipw2100_reset_adapter(priv); |
5670 | return 0; | 5647 | return 0; |
5671 | 5648 | ||
5672 | done: | 5649 | done: |
5673 | up(&priv->action_sem); | 5650 | up(&priv->action_sem); |
5674 | return err; | 5651 | return err; |
5675 | } | 5652 | } |
@@ -5708,7 +5685,7 @@ static int ipw2100_close(struct net_device *dev) | |||
5708 | /* Flush the TX queue ... */ | 5685 | /* Flush the TX queue ... */ |
5709 | while (!list_empty(&priv->tx_pend_list)) { | 5686 | while (!list_empty(&priv->tx_pend_list)) { |
5710 | element = priv->tx_pend_list.next; | 5687 | element = priv->tx_pend_list.next; |
5711 | packet = list_entry(element, struct ipw2100_tx_packet, list); | 5688 | packet = list_entry(element, struct ipw2100_tx_packet, list); |
5712 | 5689 | ||
5713 | list_del(element); | 5690 | list_del(element); |
5714 | DEC_STAT(&priv->tx_pend_stat); | 5691 | DEC_STAT(&priv->tx_pend_stat); |
@@ -5726,8 +5703,6 @@ static int ipw2100_close(struct net_device *dev) | |||
5726 | return 0; | 5703 | return 0; |
5727 | } | 5704 | } |
5728 | 5705 | ||
5729 | |||
5730 | |||
5731 | /* | 5706 | /* |
5732 | * TODO: Fix this function... its just wrong | 5707 | * TODO: Fix this function... its just wrong |
5733 | */ | 5708 | */ |
@@ -5747,7 +5722,6 @@ static void ipw2100_tx_timeout(struct net_device *dev) | |||
5747 | schedule_reset(priv); | 5722 | schedule_reset(priv); |
5748 | } | 5723 | } |
5749 | 5724 | ||
5750 | |||
5751 | /* | 5725 | /* |
5752 | * TODO: reimplement it so that it reads statistics | 5726 | * TODO: reimplement it so that it reads statistics |
5753 | * from the adapter using ordinal tables | 5727 | * from the adapter using ordinal tables |
@@ -5761,11 +5735,10 @@ static struct net_device_stats *ipw2100_stats(struct net_device *dev) | |||
5761 | return &priv->ieee->stats; | 5735 | return &priv->ieee->stats; |
5762 | } | 5736 | } |
5763 | 5737 | ||
5764 | /* Support for wpa_supplicant. Will be replaced with WEXT once | 5738 | #if WIRELESS_EXT < 18 |
5765 | * they get WPA support. */ | 5739 | /* Support for wpa_supplicant before WE-18, deprecated. */ |
5766 | #ifdef CONFIG_IEEE80211_WPA | ||
5767 | 5740 | ||
5768 | /* following definitions must match definitions in driver_ipw2100.c */ | 5741 | /* following definitions must match definitions in driver_ipw.c */ |
5769 | 5742 | ||
5770 | #define IPW2100_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 | 5743 | #define IPW2100_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 |
5771 | 5744 | ||
@@ -5796,25 +5769,26 @@ static struct net_device_stats *ipw2100_stats(struct net_device *dev) | |||
5796 | struct ipw2100_param { | 5769 | struct ipw2100_param { |
5797 | u32 cmd; | 5770 | u32 cmd; |
5798 | u8 sta_addr[ETH_ALEN]; | 5771 | u8 sta_addr[ETH_ALEN]; |
5799 | union { | 5772 | union { |
5800 | struct { | 5773 | struct { |
5801 | u8 name; | 5774 | u8 name; |
5802 | u32 value; | 5775 | u32 value; |
5803 | } wpa_param; | 5776 | } wpa_param; |
5804 | struct { | 5777 | struct { |
5805 | u32 len; | 5778 | u32 len; |
5806 | u8 *data; | 5779 | u8 reserved[32]; |
5780 | u8 data[0]; | ||
5807 | } wpa_ie; | 5781 | } wpa_ie; |
5808 | struct{ | 5782 | struct { |
5809 | int command; | 5783 | u32 command; |
5810 | int reason_code; | 5784 | u32 reason_code; |
5811 | } mlme; | 5785 | } mlme; |
5812 | struct { | 5786 | struct { |
5813 | u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; | 5787 | u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; |
5814 | u8 set_tx; | 5788 | u8 set_tx; |
5815 | u32 err; | 5789 | u32 err; |
5816 | u8 idx; | 5790 | u8 idx; |
5817 | u8 seq[8]; /* sequence counter (set: RX, get: TX) */ | 5791 | u8 seq[8]; /* sequence counter (set: RX, get: TX) */ |
5818 | u16 key_len; | 5792 | u16 key_len; |
5819 | u8 key[0]; | 5793 | u8 key[0]; |
5820 | } crypt; | 5794 | } crypt; |
@@ -5822,38 +5796,24 @@ struct ipw2100_param { | |||
5822 | } u; | 5796 | } u; |
5823 | }; | 5797 | }; |
5824 | 5798 | ||
5825 | /* end of driver_ipw2100.c code */ | 5799 | /* end of driver_ipw.c code */ |
5826 | 5800 | #endif /* WIRELESS_EXT < 18 */ | |
5827 | static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value){ | ||
5828 | 5801 | ||
5829 | struct ieee80211_device *ieee = priv->ieee; | 5802 | static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) |
5830 | struct ieee80211_security sec = { | 5803 | { |
5831 | .flags = SEC_LEVEL | SEC_ENABLED, | 5804 | /* This is called when wpa_supplicant loads and closes the driver |
5832 | }; | 5805 | * interface. */ |
5833 | int ret = 0; | 5806 | priv->ieee->wpa_enabled = value; |
5834 | 5807 | return 0; | |
5835 | ieee->wpa_enabled = value; | ||
5836 | |||
5837 | if (value){ | ||
5838 | sec.level = SEC_LEVEL_3; | ||
5839 | sec.enabled = 1; | ||
5840 | } else { | ||
5841 | sec.level = SEC_LEVEL_0; | ||
5842 | sec.enabled = 0; | ||
5843 | } | ||
5844 | |||
5845 | if (ieee->set_security) | ||
5846 | ieee->set_security(ieee->dev, &sec); | ||
5847 | else | ||
5848 | ret = -EOPNOTSUPP; | ||
5849 | |||
5850 | return ret; | ||
5851 | } | 5808 | } |
5852 | 5809 | ||
5853 | #define AUTH_ALG_OPEN_SYSTEM 0x1 | 5810 | #if WIRELESS_EXT < 18 |
5854 | #define AUTH_ALG_SHARED_KEY 0x2 | 5811 | #define IW_AUTH_ALG_OPEN_SYSTEM 0x1 |
5812 | #define IW_AUTH_ALG_SHARED_KEY 0x2 | ||
5813 | #endif | ||
5855 | 5814 | ||
5856 | static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ | 5815 | static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) |
5816 | { | ||
5857 | 5817 | ||
5858 | struct ieee80211_device *ieee = priv->ieee; | 5818 | struct ieee80211_device *ieee = priv->ieee; |
5859 | struct ieee80211_security sec = { | 5819 | struct ieee80211_security sec = { |
@@ -5861,13 +5821,14 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ | |||
5861 | }; | 5821 | }; |
5862 | int ret = 0; | 5822 | int ret = 0; |
5863 | 5823 | ||
5864 | if (value & AUTH_ALG_SHARED_KEY){ | 5824 | if (value & IW_AUTH_ALG_SHARED_KEY) { |
5865 | sec.auth_mode = WLAN_AUTH_SHARED_KEY; | 5825 | sec.auth_mode = WLAN_AUTH_SHARED_KEY; |
5866 | ieee->open_wep = 0; | 5826 | ieee->open_wep = 0; |
5867 | } else { | 5827 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { |
5868 | sec.auth_mode = WLAN_AUTH_OPEN; | 5828 | sec.auth_mode = WLAN_AUTH_OPEN; |
5869 | ieee->open_wep = 1; | 5829 | ieee->open_wep = 1; |
5870 | } | 5830 | } else |
5831 | return -EINVAL; | ||
5871 | 5832 | ||
5872 | if (ieee->set_security) | 5833 | if (ieee->set_security) |
5873 | ieee->set_security(ieee->dev, &sec); | 5834 | ieee->set_security(ieee->dev, &sec); |
@@ -5877,103 +5838,135 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ | |||
5877 | return ret; | 5838 | return ret; |
5878 | } | 5839 | } |
5879 | 5840 | ||
5841 | void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, | ||
5842 | char *wpa_ie, int wpa_ie_len) | ||
5843 | { | ||
5880 | 5844 | ||
5881 | static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value){ | 5845 | struct ipw2100_wpa_assoc_frame frame; |
5882 | |||
5883 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
5884 | int ret=0; | ||
5885 | 5846 | ||
5886 | switch(name){ | 5847 | frame.fixed_ie_mask = 0; |
5887 | case IPW2100_PARAM_WPA_ENABLED: | ||
5888 | ret = ipw2100_wpa_enable(priv, value); | ||
5889 | break; | ||
5890 | 5848 | ||
5891 | case IPW2100_PARAM_TKIP_COUNTERMEASURES: | 5849 | /* copy WPA IE */ |
5892 | priv->ieee->tkip_countermeasures=value; | 5850 | memcpy(frame.var_ie, wpa_ie, wpa_ie_len); |
5893 | break; | 5851 | frame.var_ie_len = wpa_ie_len; |
5894 | 5852 | ||
5895 | case IPW2100_PARAM_DROP_UNENCRYPTED: | 5853 | /* make sure WPA is enabled */ |
5896 | priv->ieee->drop_unencrypted=value; | 5854 | ipw2100_wpa_enable(priv, 1); |
5897 | break; | 5855 | ipw2100_set_wpa_ie(priv, &frame, 0); |
5856 | } | ||
5898 | 5857 | ||
5899 | case IPW2100_PARAM_PRIVACY_INVOKED: | 5858 | #if WIRELESS_EXT < 18 |
5900 | priv->ieee->privacy_invoked=value; | 5859 | static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) |
5901 | break; | 5860 | { |
5861 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
5862 | struct ieee80211_crypt_data *crypt; | ||
5863 | unsigned long flags; | ||
5864 | int ret = 0; | ||
5902 | 5865 | ||
5903 | case IPW2100_PARAM_AUTH_ALGS: | 5866 | switch (name) { |
5904 | ret = ipw2100_wpa_set_auth_algs(priv, value); | 5867 | case IPW2100_PARAM_WPA_ENABLED: |
5905 | break; | 5868 | ret = ipw2100_wpa_enable(priv, value); |
5869 | break; | ||
5906 | 5870 | ||
5907 | case IPW2100_PARAM_IEEE_802_1X: | 5871 | case IPW2100_PARAM_TKIP_COUNTERMEASURES: |
5908 | priv->ieee->ieee802_1x=value; | 5872 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; |
5873 | if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) | ||
5909 | break; | 5874 | break; |
5910 | 5875 | ||
5911 | default: | 5876 | flags = crypt->ops->get_flags(crypt->priv); |
5912 | printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", | ||
5913 | dev->name, name); | ||
5914 | ret = -EOPNOTSUPP; | ||
5915 | } | ||
5916 | 5877 | ||
5917 | return ret; | 5878 | if (value) |
5918 | } | 5879 | flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; |
5880 | else | ||
5881 | flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
5919 | 5882 | ||
5920 | static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason){ | 5883 | crypt->ops->set_flags(flags, crypt->priv); |
5921 | 5884 | ||
5922 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 5885 | break; |
5923 | int ret=0; | ||
5924 | 5886 | ||
5925 | switch(command){ | 5887 | case IPW2100_PARAM_DROP_UNENCRYPTED:{ |
5926 | case IPW2100_MLME_STA_DEAUTH: | 5888 | /* See IW_AUTH_DROP_UNENCRYPTED handling for details */ |
5927 | // silently ignore | 5889 | struct ieee80211_security sec = { |
5890 | .flags = SEC_ENABLED, | ||
5891 | .enabled = value, | ||
5892 | }; | ||
5893 | priv->ieee->drop_unencrypted = value; | ||
5894 | /* We only change SEC_LEVEL for open mode. Others | ||
5895 | * are set by ipw_wpa_set_encryption. | ||
5896 | */ | ||
5897 | if (!value) { | ||
5898 | sec.flags |= SEC_LEVEL; | ||
5899 | sec.level = SEC_LEVEL_0; | ||
5900 | } else { | ||
5901 | sec.flags |= SEC_LEVEL; | ||
5902 | sec.level = SEC_LEVEL_1; | ||
5903 | } | ||
5904 | if (priv->ieee->set_security) | ||
5905 | priv->ieee->set_security(priv->ieee->dev, &sec); | ||
5928 | break; | 5906 | break; |
5907 | } | ||
5929 | 5908 | ||
5930 | case IPW2100_MLME_STA_DISASSOC: | 5909 | case IPW2100_PARAM_PRIVACY_INVOKED: |
5931 | ipw2100_disassociate_bssid(priv); | 5910 | priv->ieee->privacy_invoked = value; |
5932 | break; | 5911 | break; |
5933 | 5912 | ||
5934 | default: | 5913 | case IPW2100_PARAM_AUTH_ALGS: |
5935 | printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", | 5914 | ret = ipw2100_wpa_set_auth_algs(priv, value); |
5936 | dev->name, command); | 5915 | break; |
5937 | ret = -EOPNOTSUPP; | 5916 | |
5917 | case IPW2100_PARAM_IEEE_802_1X: | ||
5918 | priv->ieee->ieee802_1x = value; | ||
5919 | break; | ||
5920 | |||
5921 | default: | ||
5922 | printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", | ||
5923 | dev->name, name); | ||
5924 | ret = -EOPNOTSUPP; | ||
5938 | } | 5925 | } |
5939 | 5926 | ||
5940 | return ret; | 5927 | return ret; |
5941 | } | 5928 | } |
5942 | 5929 | ||
5930 | static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason) | ||
5931 | { | ||
5943 | 5932 | ||
5944 | void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, | 5933 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
5945 | char *wpa_ie, int wpa_ie_len){ | 5934 | int ret = 0; |
5946 | 5935 | ||
5947 | struct ipw2100_wpa_assoc_frame frame; | 5936 | switch (command) { |
5937 | case IPW2100_MLME_STA_DEAUTH: | ||
5938 | // silently ignore | ||
5939 | break; | ||
5948 | 5940 | ||
5949 | frame.fixed_ie_mask = 0; | 5941 | case IPW2100_MLME_STA_DISASSOC: |
5942 | ipw2100_disassociate_bssid(priv); | ||
5943 | break; | ||
5950 | 5944 | ||
5951 | /* copy WPA IE */ | 5945 | default: |
5952 | memcpy(frame.var_ie, wpa_ie, wpa_ie_len); | 5946 | printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", |
5953 | frame.var_ie_len = wpa_ie_len; | 5947 | dev->name, command); |
5948 | ret = -EOPNOTSUPP; | ||
5949 | } | ||
5954 | 5950 | ||
5955 | /* make sure WPA is enabled */ | 5951 | return ret; |
5956 | ipw2100_wpa_enable(priv, 1); | ||
5957 | ipw2100_set_wpa_ie(priv, &frame, 0); | ||
5958 | } | 5952 | } |
5959 | 5953 | ||
5960 | |||
5961 | static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, | 5954 | static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, |
5962 | struct ipw2100_param *param, int plen){ | 5955 | struct ipw2100_param *param, int plen) |
5956 | { | ||
5963 | 5957 | ||
5964 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 5958 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
5965 | struct ieee80211_device *ieee = priv->ieee; | 5959 | struct ieee80211_device *ieee = priv->ieee; |
5966 | u8 *buf; | 5960 | u8 *buf; |
5967 | 5961 | ||
5968 | if (! ieee->wpa_enabled) | 5962 | if (!ieee->wpa_enabled) |
5969 | return -EOPNOTSUPP; | 5963 | return -EOPNOTSUPP; |
5970 | 5964 | ||
5971 | if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || | 5965 | if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || |
5972 | (param->u.wpa_ie.len && | 5966 | (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) |
5973 | param->u.wpa_ie.data==NULL)) | ||
5974 | return -EINVAL; | 5967 | return -EINVAL; |
5975 | 5968 | ||
5976 | if (param->u.wpa_ie.len){ | 5969 | if (param->u.wpa_ie.len) { |
5977 | buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); | 5970 | buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); |
5978 | if (buf == NULL) | 5971 | if (buf == NULL) |
5979 | return -ENOMEM; | 5972 | return -ENOMEM; |
@@ -5998,8 +5991,9 @@ static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, | |||
5998 | /* implementation borrowed from hostap driver */ | 5991 | /* implementation borrowed from hostap driver */ |
5999 | 5992 | ||
6000 | static int ipw2100_wpa_set_encryption(struct net_device *dev, | 5993 | static int ipw2100_wpa_set_encryption(struct net_device *dev, |
6001 | struct ipw2100_param *param, int param_len){ | 5994 | struct ipw2100_param *param, |
6002 | 5995 | int param_len) | |
5996 | { | ||
6003 | int ret = 0; | 5997 | int ret = 0; |
6004 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 5998 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
6005 | struct ieee80211_device *ieee = priv->ieee; | 5999 | struct ieee80211_device *ieee = priv->ieee; |
@@ -6014,9 +6008,10 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6014 | param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0'; | 6008 | param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0'; |
6015 | 6009 | ||
6016 | if (param_len != | 6010 | if (param_len != |
6017 | (int) ((char *) param->u.crypt.key - (char *) param) + | 6011 | (int)((char *)param->u.crypt.key - (char *)param) + |
6018 | param->u.crypt.key_len){ | 6012 | param->u.crypt.key_len) { |
6019 | IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, param->u.crypt.key_len); | 6013 | IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, |
6014 | param->u.crypt.key_len); | ||
6020 | return -EINVAL; | 6015 | return -EINVAL; |
6021 | } | 6016 | } |
6022 | if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && | 6017 | if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && |
@@ -6029,17 +6024,19 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6029 | return -EINVAL; | 6024 | return -EINVAL; |
6030 | } | 6025 | } |
6031 | 6026 | ||
6027 | sec.flags |= SEC_ENABLED | SEC_ENCRYPT; | ||
6032 | if (strcmp(param->u.crypt.alg, "none") == 0) { | 6028 | if (strcmp(param->u.crypt.alg, "none") == 0) { |
6033 | if (crypt){ | 6029 | if (crypt) { |
6034 | sec.enabled = 0; | 6030 | sec.enabled = 0; |
6031 | sec.encrypt = 0; | ||
6035 | sec.level = SEC_LEVEL_0; | 6032 | sec.level = SEC_LEVEL_0; |
6036 | sec.flags |= SEC_ENABLED | SEC_LEVEL; | 6033 | sec.flags |= SEC_LEVEL; |
6037 | ieee80211_crypt_delayed_deinit(ieee, crypt); | 6034 | ieee80211_crypt_delayed_deinit(ieee, crypt); |
6038 | } | 6035 | } |
6039 | goto done; | 6036 | goto done; |
6040 | } | 6037 | } |
6041 | sec.enabled = 1; | 6038 | sec.enabled = 1; |
6042 | sec.flags |= SEC_ENABLED; | 6039 | sec.encrypt = 1; |
6043 | 6040 | ||
6044 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | 6041 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); |
6045 | if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { | 6042 | if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { |
@@ -6054,7 +6051,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6054 | } | 6051 | } |
6055 | if (ops == NULL) { | 6052 | if (ops == NULL) { |
6056 | IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", | 6053 | IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", |
6057 | dev->name, param->u.crypt.alg); | 6054 | dev->name, param->u.crypt.alg); |
6058 | param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG; | 6055 | param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG; |
6059 | ret = -EINVAL; | 6056 | ret = -EINVAL; |
6060 | goto done; | 6057 | goto done; |
@@ -6065,21 +6062,20 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6065 | 6062 | ||
6066 | ieee80211_crypt_delayed_deinit(ieee, crypt); | 6063 | ieee80211_crypt_delayed_deinit(ieee, crypt); |
6067 | 6064 | ||
6068 | new_crypt = (struct ieee80211_crypt_data *) | 6065 | new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); |
6069 | kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); | ||
6070 | if (new_crypt == NULL) { | 6066 | if (new_crypt == NULL) { |
6071 | ret = -ENOMEM; | 6067 | ret = -ENOMEM; |
6072 | goto done; | 6068 | goto done; |
6073 | } | 6069 | } |
6074 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); | ||
6075 | new_crypt->ops = ops; | 6070 | new_crypt->ops = ops; |
6076 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) | 6071 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) |
6077 | new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); | 6072 | new_crypt->priv = |
6073 | new_crypt->ops->init(param->u.crypt.idx); | ||
6078 | 6074 | ||
6079 | if (new_crypt->priv == NULL) { | 6075 | if (new_crypt->priv == NULL) { |
6080 | kfree(new_crypt); | 6076 | kfree(new_crypt); |
6081 | param->u.crypt.err = | 6077 | param->u.crypt.err = |
6082 | IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; | 6078 | IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; |
6083 | ret = -EINVAL; | 6079 | ret = -EINVAL; |
6084 | goto done; | 6080 | goto done; |
6085 | } | 6081 | } |
@@ -6091,24 +6087,25 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6091 | (*crypt)->ops->set_key(param->u.crypt.key, | 6087 | (*crypt)->ops->set_key(param->u.crypt.key, |
6092 | param->u.crypt.key_len, param->u.crypt.seq, | 6088 | param->u.crypt.key_len, param->u.crypt.seq, |
6093 | (*crypt)->priv) < 0) { | 6089 | (*crypt)->priv) < 0) { |
6094 | IPW_DEBUG_INFO("%s: key setting failed\n", | 6090 | IPW_DEBUG_INFO("%s: key setting failed\n", dev->name); |
6095 | dev->name); | ||
6096 | param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED; | 6091 | param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED; |
6097 | ret = -EINVAL; | 6092 | ret = -EINVAL; |
6098 | goto done; | 6093 | goto done; |
6099 | } | 6094 | } |
6100 | 6095 | ||
6101 | if (param->u.crypt.set_tx){ | 6096 | if (param->u.crypt.set_tx) { |
6102 | ieee->tx_keyidx = param->u.crypt.idx; | 6097 | ieee->tx_keyidx = param->u.crypt.idx; |
6103 | sec.active_key = param->u.crypt.idx; | 6098 | sec.active_key = param->u.crypt.idx; |
6104 | sec.flags |= SEC_ACTIVE_KEY; | 6099 | sec.flags |= SEC_ACTIVE_KEY; |
6105 | } | 6100 | } |
6106 | 6101 | ||
6107 | if (ops->name != NULL){ | 6102 | if (ops->name != NULL) { |
6108 | 6103 | ||
6109 | if (strcmp(ops->name, "WEP") == 0) { | 6104 | if (strcmp(ops->name, "WEP") == 0) { |
6110 | memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key, param->u.crypt.key_len); | 6105 | memcpy(sec.keys[param->u.crypt.idx], |
6111 | sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; | 6106 | param->u.crypt.key, param->u.crypt.key_len); |
6107 | sec.key_sizes[param->u.crypt.idx] = | ||
6108 | param->u.crypt.key_len; | ||
6112 | sec.flags |= (1 << param->u.crypt.idx); | 6109 | sec.flags |= (1 << param->u.crypt.idx); |
6113 | sec.flags |= SEC_LEVEL; | 6110 | sec.flags |= SEC_LEVEL; |
6114 | sec.level = SEC_LEVEL_1; | 6111 | sec.level = SEC_LEVEL_1; |
@@ -6120,7 +6117,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6120 | sec.level = SEC_LEVEL_3; | 6117 | sec.level = SEC_LEVEL_3; |
6121 | } | 6118 | } |
6122 | } | 6119 | } |
6123 | done: | 6120 | done: |
6124 | if (ieee->set_security) | 6121 | if (ieee->set_security) |
6125 | ieee->set_security(ieee->dev, &sec); | 6122 | ieee->set_security(ieee->dev, &sec); |
6126 | 6123 | ||
@@ -6131,8 +6128,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6131 | * the callbacks structures used to initialize the 802.11 stack. */ | 6128 | * the callbacks structures used to initialize the 802.11 stack. */ |
6132 | if (ieee->reset_on_keychange && | 6129 | if (ieee->reset_on_keychange && |
6133 | ieee->iw_mode != IW_MODE_INFRA && | 6130 | ieee->iw_mode != IW_MODE_INFRA && |
6134 | ieee->reset_port && | 6131 | ieee->reset_port && ieee->reset_port(dev)) { |
6135 | ieee->reset_port(dev)) { | ||
6136 | IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); | 6132 | IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); |
6137 | param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED; | 6133 | param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED; |
6138 | return -EINVAL; | 6134 | return -EINVAL; |
@@ -6141,11 +6137,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6141 | return ret; | 6137 | return ret; |
6142 | } | 6138 | } |
6143 | 6139 | ||
6144 | 6140 | static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p) | |
6145 | static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ | 6141 | { |
6146 | 6142 | ||
6147 | struct ipw2100_param *param; | 6143 | struct ipw2100_param *param; |
6148 | int ret=0; | 6144 | int ret = 0; |
6149 | 6145 | ||
6150 | IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length); | 6146 | IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length); |
6151 | 6147 | ||
@@ -6156,12 +6152,12 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ | |||
6156 | if (param == NULL) | 6152 | if (param == NULL) |
6157 | return -ENOMEM; | 6153 | return -ENOMEM; |
6158 | 6154 | ||
6159 | if (copy_from_user(param, p->pointer, p->length)){ | 6155 | if (copy_from_user(param, p->pointer, p->length)) { |
6160 | kfree(param); | 6156 | kfree(param); |
6161 | return -EFAULT; | 6157 | return -EFAULT; |
6162 | } | 6158 | } |
6163 | 6159 | ||
6164 | switch (param->cmd){ | 6160 | switch (param->cmd) { |
6165 | 6161 | ||
6166 | case IPW2100_CMD_SET_WPA_PARAM: | 6162 | case IPW2100_CMD_SET_WPA_PARAM: |
6167 | ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name, | 6163 | ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name, |
@@ -6182,8 +6178,9 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ | |||
6182 | break; | 6178 | break; |
6183 | 6179 | ||
6184 | default: | 6180 | default: |
6185 | printk(KERN_ERR DRV_NAME ": %s: Unknown WPA supplicant request: %d\n", | 6181 | printk(KERN_ERR DRV_NAME |
6186 | dev->name, param->cmd); | 6182 | ": %s: Unknown WPA supplicant request: %d\n", dev->name, |
6183 | param->cmd); | ||
6187 | ret = -EOPNOTSUPP; | 6184 | ret = -EOPNOTSUPP; |
6188 | 6185 | ||
6189 | } | 6186 | } |
@@ -6194,27 +6191,23 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ | |||
6194 | kfree(param); | 6191 | kfree(param); |
6195 | return ret; | 6192 | return ret; |
6196 | } | 6193 | } |
6197 | #endif /* CONFIG_IEEE80211_WPA */ | ||
6198 | 6194 | ||
6199 | static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 6195 | static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
6200 | { | 6196 | { |
6201 | #ifdef CONFIG_IEEE80211_WPA | 6197 | struct iwreq *wrq = (struct iwreq *)rq; |
6202 | struct iwreq *wrq = (struct iwreq *) rq; | 6198 | int ret = -1; |
6203 | int ret=-1; | 6199 | switch (cmd) { |
6204 | switch (cmd){ | 6200 | case IPW2100_IOCTL_WPA_SUPPLICANT: |
6205 | case IPW2100_IOCTL_WPA_SUPPLICANT: | ||
6206 | ret = ipw2100_wpa_supplicant(dev, &wrq->u.data); | 6201 | ret = ipw2100_wpa_supplicant(dev, &wrq->u.data); |
6207 | return ret; | 6202 | return ret; |
6208 | 6203 | ||
6209 | default: | 6204 | default: |
6210 | return -EOPNOTSUPP; | 6205 | return -EOPNOTSUPP; |
6211 | } | 6206 | } |
6212 | 6207 | ||
6213 | #endif /* CONFIG_IEEE80211_WPA */ | ||
6214 | |||
6215 | return -EOPNOTSUPP; | 6208 | return -EOPNOTSUPP; |
6216 | } | 6209 | } |
6217 | 6210 | #endif /* WIRELESS_EXT < 18 */ | |
6218 | 6211 | ||
6219 | static void ipw_ethtool_get_drvinfo(struct net_device *dev, | 6212 | static void ipw_ethtool_get_drvinfo(struct net_device *dev, |
6220 | struct ethtool_drvinfo *info) | 6213 | struct ethtool_drvinfo *info) |
@@ -6236,14 +6229,13 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, | |||
6236 | 6229 | ||
6237 | static u32 ipw2100_ethtool_get_link(struct net_device *dev) | 6230 | static u32 ipw2100_ethtool_get_link(struct net_device *dev) |
6238 | { | 6231 | { |
6239 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 6232 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
6240 | return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; | 6233 | return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; |
6241 | } | 6234 | } |
6242 | 6235 | ||
6243 | |||
6244 | static struct ethtool_ops ipw2100_ethtool_ops = { | 6236 | static struct ethtool_ops ipw2100_ethtool_ops = { |
6245 | .get_link = ipw2100_ethtool_get_link, | 6237 | .get_link = ipw2100_ethtool_get_link, |
6246 | .get_drvinfo = ipw_ethtool_get_drvinfo, | 6238 | .get_drvinfo = ipw_ethtool_get_drvinfo, |
6247 | }; | 6239 | }; |
6248 | 6240 | ||
6249 | static void ipw2100_hang_check(void *adapter) | 6241 | static void ipw2100_hang_check(void *adapter) |
@@ -6288,7 +6280,6 @@ static void ipw2100_hang_check(void *adapter) | |||
6288 | spin_unlock_irqrestore(&priv->low_lock, flags); | 6280 | spin_unlock_irqrestore(&priv->low_lock, flags); |
6289 | } | 6281 | } |
6290 | 6282 | ||
6291 | |||
6292 | static void ipw2100_rf_kill(void *adapter) | 6283 | static void ipw2100_rf_kill(void *adapter) |
6293 | { | 6284 | { |
6294 | struct ipw2100_priv *priv = adapter; | 6285 | struct ipw2100_priv *priv = adapter; |
@@ -6313,7 +6304,7 @@ static void ipw2100_rf_kill(void *adapter) | |||
6313 | IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " | 6304 | IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " |
6314 | "enabled\n"); | 6305 | "enabled\n"); |
6315 | 6306 | ||
6316 | exit_unlock: | 6307 | exit_unlock: |
6317 | spin_unlock_irqrestore(&priv->low_lock, flags); | 6308 | spin_unlock_irqrestore(&priv->low_lock, flags); |
6318 | } | 6309 | } |
6319 | 6310 | ||
@@ -6321,11 +6312,10 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv); | |||
6321 | 6312 | ||
6322 | /* Look into using netdev destructor to shutdown ieee80211? */ | 6313 | /* Look into using netdev destructor to shutdown ieee80211? */ |
6323 | 6314 | ||
6324 | static struct net_device *ipw2100_alloc_device( | 6315 | static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, |
6325 | struct pci_dev *pci_dev, | 6316 | void __iomem * base_addr, |
6326 | void __iomem *base_addr, | 6317 | unsigned long mem_start, |
6327 | unsigned long mem_start, | 6318 | unsigned long mem_len) |
6328 | unsigned long mem_len) | ||
6329 | { | 6319 | { |
6330 | struct ipw2100_priv *priv; | 6320 | struct ipw2100_priv *priv; |
6331 | struct net_device *dev; | 6321 | struct net_device *dev; |
@@ -6341,17 +6331,22 @@ static struct net_device *ipw2100_alloc_device( | |||
6341 | priv->ieee->hard_start_xmit = ipw2100_tx; | 6331 | priv->ieee->hard_start_xmit = ipw2100_tx; |
6342 | priv->ieee->set_security = shim__set_security; | 6332 | priv->ieee->set_security = shim__set_security; |
6343 | 6333 | ||
6334 | priv->ieee->perfect_rssi = -20; | ||
6335 | priv->ieee->worst_rssi = -85; | ||
6336 | |||
6344 | dev->open = ipw2100_open; | 6337 | dev->open = ipw2100_open; |
6345 | dev->stop = ipw2100_close; | 6338 | dev->stop = ipw2100_close; |
6346 | dev->init = ipw2100_net_init; | 6339 | dev->init = ipw2100_net_init; |
6340 | #if WIRELESS_EXT < 18 | ||
6347 | dev->do_ioctl = ipw2100_ioctl; | 6341 | dev->do_ioctl = ipw2100_ioctl; |
6342 | #endif | ||
6348 | dev->get_stats = ipw2100_stats; | 6343 | dev->get_stats = ipw2100_stats; |
6349 | dev->ethtool_ops = &ipw2100_ethtool_ops; | 6344 | dev->ethtool_ops = &ipw2100_ethtool_ops; |
6350 | dev->tx_timeout = ipw2100_tx_timeout; | 6345 | dev->tx_timeout = ipw2100_tx_timeout; |
6351 | dev->wireless_handlers = &ipw2100_wx_handler_def; | 6346 | dev->wireless_handlers = &ipw2100_wx_handler_def; |
6352 | dev->get_wireless_stats = ipw2100_wx_wireless_stats; | 6347 | dev->get_wireless_stats = ipw2100_wx_wireless_stats; |
6353 | dev->set_mac_address = ipw2100_set_address; | 6348 | dev->set_mac_address = ipw2100_set_address; |
6354 | dev->watchdog_timeo = 3*HZ; | 6349 | dev->watchdog_timeo = 3 * HZ; |
6355 | dev->irq = 0; | 6350 | dev->irq = 0; |
6356 | 6351 | ||
6357 | dev->base_addr = (unsigned long)base_addr; | 6352 | dev->base_addr = (unsigned long)base_addr; |
@@ -6364,22 +6359,19 @@ static struct net_device *ipw2100_alloc_device( | |||
6364 | * ends up causing problems. So, we just handle | 6359 | * ends up causing problems. So, we just handle |
6365 | * the WX extensions through the ipw2100_ioctl interface */ | 6360 | * the WX extensions through the ipw2100_ioctl interface */ |
6366 | 6361 | ||
6367 | |||
6368 | /* memset() puts everything to 0, so we only have explicitely set | 6362 | /* memset() puts everything to 0, so we only have explicitely set |
6369 | * those values that need to be something else */ | 6363 | * those values that need to be something else */ |
6370 | 6364 | ||
6371 | /* If power management is turned on, default to AUTO mode */ | 6365 | /* If power management is turned on, default to AUTO mode */ |
6372 | priv->power_mode = IPW_POWER_AUTO; | 6366 | priv->power_mode = IPW_POWER_AUTO; |
6373 | 6367 | ||
6374 | 6368 | #ifdef CONFIG_IPW2100_MONITOR | |
6375 | 6369 | priv->config |= CFG_CRC_CHECK; | |
6376 | #ifdef CONFIG_IEEE80211_WPA | 6370 | #endif |
6377 | priv->ieee->wpa_enabled = 0; | 6371 | priv->ieee->wpa_enabled = 0; |
6378 | priv->ieee->tkip_countermeasures = 0; | ||
6379 | priv->ieee->drop_unencrypted = 0; | 6372 | priv->ieee->drop_unencrypted = 0; |
6380 | priv->ieee->privacy_invoked = 0; | 6373 | priv->ieee->privacy_invoked = 0; |
6381 | priv->ieee->ieee802_1x = 1; | 6374 | priv->ieee->ieee802_1x = 1; |
6382 | #endif /* CONFIG_IEEE80211_WPA */ | ||
6383 | 6375 | ||
6384 | /* Set module parameters */ | 6376 | /* Set module parameters */ |
6385 | switch (mode) { | 6377 | switch (mode) { |
@@ -6401,8 +6393,7 @@ static struct net_device *ipw2100_alloc_device( | |||
6401 | priv->status |= STATUS_RF_KILL_SW; | 6393 | priv->status |= STATUS_RF_KILL_SW; |
6402 | 6394 | ||
6403 | if (channel != 0 && | 6395 | if (channel != 0 && |
6404 | ((channel >= REG_MIN_CHANNEL) && | 6396 | ((channel >= REG_MIN_CHANNEL) && (channel <= REG_MAX_CHANNEL))) { |
6405 | (channel <= REG_MAX_CHANNEL))) { | ||
6406 | priv->config |= CFG_STATIC_CHANNEL; | 6397 | priv->config |= CFG_STATIC_CHANNEL; |
6407 | priv->channel = channel; | 6398 | priv->channel = channel; |
6408 | } | 6399 | } |
@@ -6441,12 +6432,8 @@ static struct net_device *ipw2100_alloc_device( | |||
6441 | INIT_LIST_HEAD(&priv->fw_pend_list); | 6432 | INIT_LIST_HEAD(&priv->fw_pend_list); |
6442 | INIT_STAT(&priv->fw_pend_stat); | 6433 | INIT_STAT(&priv->fw_pend_stat); |
6443 | 6434 | ||
6444 | |||
6445 | #ifdef CONFIG_SOFTWARE_SUSPEND2 | ||
6446 | priv->workqueue = create_workqueue(DRV_NAME, 0); | ||
6447 | #else | ||
6448 | priv->workqueue = create_workqueue(DRV_NAME); | 6435 | priv->workqueue = create_workqueue(DRV_NAME); |
6449 | #endif | 6436 | |
6450 | INIT_WORK(&priv->reset_work, | 6437 | INIT_WORK(&priv->reset_work, |
6451 | (void (*)(void *))ipw2100_reset_adapter, priv); | 6438 | (void (*)(void *))ipw2100_reset_adapter, priv); |
6452 | INIT_WORK(&priv->security_work, | 6439 | INIT_WORK(&priv->security_work, |
@@ -6535,7 +6522,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6535 | return err; | 6522 | return err; |
6536 | } | 6523 | } |
6537 | 6524 | ||
6538 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | 6525 | /* We disable the RETRY_TIMEOUT register (0x41) to keep |
6539 | * PCI Tx retries from interfering with C3 CPU state */ | 6526 | * PCI Tx retries from interfering with C3 CPU state */ |
6540 | pci_read_config_dword(pci_dev, 0x40, &val); | 6527 | pci_read_config_dword(pci_dev, 0x40, &val); |
6541 | if ((val & 0x0000ff00) != 0) | 6528 | if ((val & 0x0000ff00) != 0) |
@@ -6566,12 +6553,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6566 | ipw2100_queues_initialize(priv); | 6553 | ipw2100_queues_initialize(priv); |
6567 | 6554 | ||
6568 | err = request_irq(pci_dev->irq, | 6555 | err = request_irq(pci_dev->irq, |
6569 | ipw2100_interrupt, SA_SHIRQ, | 6556 | ipw2100_interrupt, SA_SHIRQ, dev->name, priv); |
6570 | dev->name, priv); | ||
6571 | if (err) { | 6557 | if (err) { |
6572 | printk(KERN_WARNING DRV_NAME | 6558 | printk(KERN_WARNING DRV_NAME |
6573 | "Error calling request_irq: %d.\n", | 6559 | "Error calling request_irq: %d.\n", pci_dev->irq); |
6574 | pci_dev->irq); | ||
6575 | goto fail; | 6560 | goto fail; |
6576 | } | 6561 | } |
6577 | dev->irq = pci_dev->irq; | 6562 | dev->irq = pci_dev->irq; |
@@ -6606,7 +6591,6 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6606 | 6591 | ||
6607 | /* perform this after register_netdev so that dev->name is set */ | 6592 | /* perform this after register_netdev so that dev->name is set */ |
6608 | sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); | 6593 | sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); |
6609 | netif_carrier_off(dev); | ||
6610 | 6594 | ||
6611 | /* If the RF Kill switch is disabled, go ahead and complete the | 6595 | /* If the RF Kill switch is disabled, go ahead and complete the |
6612 | * startup sequence */ | 6596 | * startup sequence */ |
@@ -6634,10 +6618,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6634 | 6618 | ||
6635 | return 0; | 6619 | return 0; |
6636 | 6620 | ||
6637 | fail_unlock: | 6621 | fail_unlock: |
6638 | up(&priv->action_sem); | 6622 | up(&priv->action_sem); |
6639 | 6623 | ||
6640 | fail: | 6624 | fail: |
6641 | if (dev) { | 6625 | if (dev) { |
6642 | if (registered) | 6626 | if (registered) |
6643 | unregister_netdev(dev); | 6627 | unregister_netdev(dev); |
@@ -6653,7 +6637,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6653 | 6637 | ||
6654 | /* These are safe to call even if they weren't allocated */ | 6638 | /* These are safe to call even if they weren't allocated */ |
6655 | ipw2100_queues_free(priv); | 6639 | ipw2100_queues_free(priv); |
6656 | sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); | 6640 | sysfs_remove_group(&pci_dev->dev.kobj, |
6641 | &ipw2100_attribute_group); | ||
6657 | 6642 | ||
6658 | free_ieee80211(dev); | 6643 | free_ieee80211(dev); |
6659 | pci_set_drvdata(pci_dev, NULL); | 6644 | pci_set_drvdata(pci_dev, NULL); |
@@ -6679,7 +6664,8 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) | |||
6679 | priv->status &= ~STATUS_INITIALIZED; | 6664 | priv->status &= ~STATUS_INITIALIZED; |
6680 | 6665 | ||
6681 | dev = priv->net_dev; | 6666 | dev = priv->net_dev; |
6682 | sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); | 6667 | sysfs_remove_group(&pci_dev->dev.kobj, |
6668 | &ipw2100_attribute_group); | ||
6683 | 6669 | ||
6684 | #ifdef CONFIG_PM | 6670 | #ifdef CONFIG_PM |
6685 | if (ipw2100_firmware.version) | 6671 | if (ipw2100_firmware.version) |
@@ -6721,19 +6707,13 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) | |||
6721 | IPW_DEBUG_INFO("exit\n"); | 6707 | IPW_DEBUG_INFO("exit\n"); |
6722 | } | 6708 | } |
6723 | 6709 | ||
6724 | |||
6725 | #ifdef CONFIG_PM | 6710 | #ifdef CONFIG_PM |
6726 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) | ||
6727 | static int ipw2100_suspend(struct pci_dev *pci_dev, u32 state) | ||
6728 | #else | ||
6729 | static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) | 6711 | static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) |
6730 | #endif | ||
6731 | { | 6712 | { |
6732 | struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); | 6713 | struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); |
6733 | struct net_device *dev = priv->net_dev; | 6714 | struct net_device *dev = priv->net_dev; |
6734 | 6715 | ||
6735 | IPW_DEBUG_INFO("%s: Going into suspend...\n", | 6716 | IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); |
6736 | dev->name); | ||
6737 | 6717 | ||
6738 | down(&priv->action_sem); | 6718 | down(&priv->action_sem); |
6739 | if (priv->status & STATUS_INITIALIZED) { | 6719 | if (priv->status & STATUS_INITIALIZED) { |
@@ -6745,7 +6725,7 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
6745 | netif_device_detach(dev); | 6725 | netif_device_detach(dev); |
6746 | 6726 | ||
6747 | pci_save_state(pci_dev); | 6727 | pci_save_state(pci_dev); |
6748 | pci_disable_device (pci_dev); | 6728 | pci_disable_device(pci_dev); |
6749 | pci_set_power_state(pci_dev, PCI_D3hot); | 6729 | pci_set_power_state(pci_dev, PCI_D3hot); |
6750 | 6730 | ||
6751 | up(&priv->action_sem); | 6731 | up(&priv->action_sem); |
@@ -6764,8 +6744,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev) | |||
6764 | 6744 | ||
6765 | down(&priv->action_sem); | 6745 | down(&priv->action_sem); |
6766 | 6746 | ||
6767 | IPW_DEBUG_INFO("%s: Coming out of suspend...\n", | 6747 | IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); |
6768 | dev->name); | ||
6769 | 6748 | ||
6770 | pci_set_power_state(pci_dev, PCI_D0); | 6749 | pci_set_power_state(pci_dev, PCI_D0); |
6771 | pci_enable_device(pci_dev); | 6750 | pci_enable_device(pci_dev); |
@@ -6785,9 +6764,9 @@ static int ipw2100_resume(struct pci_dev *pci_dev) | |||
6785 | * the queue of needed */ | 6764 | * the queue of needed */ |
6786 | netif_device_attach(dev); | 6765 | netif_device_attach(dev); |
6787 | 6766 | ||
6788 | /* Bring the device back up */ | 6767 | /* Bring the device back up */ |
6789 | if (!(priv->status & STATUS_RF_KILL_SW)) | 6768 | if (!(priv->status & STATUS_RF_KILL_SW)) |
6790 | ipw2100_up(priv, 0); | 6769 | ipw2100_up(priv, 0); |
6791 | 6770 | ||
6792 | up(&priv->action_sem); | 6771 | up(&priv->action_sem); |
6793 | 6772 | ||
@@ -6795,56 +6774,55 @@ static int ipw2100_resume(struct pci_dev *pci_dev) | |||
6795 | } | 6774 | } |
6796 | #endif | 6775 | #endif |
6797 | 6776 | ||
6798 | |||
6799 | #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } | 6777 | #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } |
6800 | 6778 | ||
6801 | static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = { | 6779 | static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = { |
6802 | IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ | 6780 | IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ |
6803 | IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ | 6781 | IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ |
6804 | IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ | 6782 | IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ |
6805 | IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ | 6783 | IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ |
6806 | IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ | 6784 | IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ |
6807 | IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ | 6785 | IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ |
6808 | IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ | 6786 | IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ |
6809 | IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ | 6787 | IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ |
6810 | IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ | 6788 | IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ |
6811 | IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ | 6789 | IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ |
6812 | IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ | 6790 | IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ |
6813 | IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ | 6791 | IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ |
6814 | IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ | 6792 | IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ |
6815 | 6793 | ||
6816 | IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ | 6794 | IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ |
6817 | IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ | 6795 | IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ |
6818 | IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ | 6796 | IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ |
6819 | IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ | 6797 | IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ |
6820 | IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ | 6798 | IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ |
6821 | 6799 | ||
6822 | IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ | 6800 | IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ |
6823 | IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ | 6801 | IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ |
6824 | IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ | 6802 | IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ |
6825 | IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ | 6803 | IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ |
6826 | IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ | 6804 | IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ |
6827 | IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ | 6805 | IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ |
6828 | IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ | 6806 | IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ |
6829 | 6807 | ||
6830 | IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ | 6808 | IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ |
6831 | 6809 | ||
6832 | IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ | 6810 | IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ |
6833 | IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ | 6811 | IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ |
6834 | IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ | 6812 | IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ |
6835 | IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ | 6813 | IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ |
6836 | IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ | 6814 | IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ |
6837 | IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ | 6815 | IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ |
6838 | IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ | 6816 | IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ |
6839 | 6817 | ||
6840 | IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ | 6818 | IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ |
6841 | IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ | 6819 | IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ |
6842 | IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ | 6820 | IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ |
6843 | IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ | 6821 | IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ |
6844 | IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ | 6822 | IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ |
6845 | IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ | 6823 | IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ |
6846 | 6824 | ||
6847 | IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ | 6825 | IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ |
6848 | {0,}, | 6826 | {0,}, |
6849 | }; | 6827 | }; |
6850 | 6828 | ||
@@ -6861,7 +6839,6 @@ static struct pci_driver ipw2100_pci_driver = { | |||
6861 | #endif | 6839 | #endif |
6862 | }; | 6840 | }; |
6863 | 6841 | ||
6864 | |||
6865 | /** | 6842 | /** |
6866 | * Initialize the ipw2100 driver/module | 6843 | * Initialize the ipw2100 driver/module |
6867 | * | 6844 | * |
@@ -6878,10 +6855,6 @@ static int __init ipw2100_init(void) | |||
6878 | printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); | 6855 | printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); |
6879 | printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); | 6856 | printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); |
6880 | 6857 | ||
6881 | #ifdef CONFIG_IEEE80211_NOWEP | ||
6882 | IPW_DEBUG_INFO(DRV_NAME ": Compiled with WEP disabled.\n"); | ||
6883 | #endif | ||
6884 | |||
6885 | ret = pci_module_init(&ipw2100_pci_driver); | 6858 | ret = pci_module_init(&ipw2100_pci_driver); |
6886 | 6859 | ||
6887 | #ifdef CONFIG_IPW_DEBUG | 6860 | #ifdef CONFIG_IPW_DEBUG |
@@ -6893,7 +6866,6 @@ static int __init ipw2100_init(void) | |||
6893 | return ret; | 6866 | return ret; |
6894 | } | 6867 | } |
6895 | 6868 | ||
6896 | |||
6897 | /** | 6869 | /** |
6898 | * Cleanup ipw2100 driver registration | 6870 | * Cleanup ipw2100 driver registration |
6899 | */ | 6871 | */ |
@@ -6949,7 +6921,6 @@ static int ipw2100_wx_get_name(struct net_device *dev, | |||
6949 | return 0; | 6921 | return 0; |
6950 | } | 6922 | } |
6951 | 6923 | ||
6952 | |||
6953 | static int ipw2100_wx_set_freq(struct net_device *dev, | 6924 | static int ipw2100_wx_set_freq(struct net_device *dev, |
6954 | struct iw_request_info *info, | 6925 | struct iw_request_info *info, |
6955 | union iwreq_data *wrqu, char *extra) | 6926 | union iwreq_data *wrqu, char *extra) |
@@ -6969,8 +6940,7 @@ static int ipw2100_wx_set_freq(struct net_device *dev, | |||
6969 | 6940 | ||
6970 | /* if setting by freq convert to channel */ | 6941 | /* if setting by freq convert to channel */ |
6971 | if (fwrq->e == 1) { | 6942 | if (fwrq->e == 1) { |
6972 | if ((fwrq->m >= (int) 2.412e8 && | 6943 | if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { |
6973 | fwrq->m <= (int) 2.487e8)) { | ||
6974 | int f = fwrq->m / 100000; | 6944 | int f = fwrq->m / 100000; |
6975 | int c = 0; | 6945 | int c = 0; |
6976 | 6946 | ||
@@ -6984,19 +6954,19 @@ static int ipw2100_wx_set_freq(struct net_device *dev, | |||
6984 | } | 6954 | } |
6985 | } | 6955 | } |
6986 | 6956 | ||
6987 | if (fwrq->e > 0 || fwrq->m > 1000) | 6957 | if (fwrq->e > 0 || fwrq->m > 1000) { |
6988 | return -EOPNOTSUPP; | 6958 | err = -EOPNOTSUPP; |
6989 | else { /* Set the channel */ | 6959 | goto done; |
6960 | } else { /* Set the channel */ | ||
6990 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); | 6961 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); |
6991 | err = ipw2100_set_channel(priv, fwrq->m, 0); | 6962 | err = ipw2100_set_channel(priv, fwrq->m, 0); |
6992 | } | 6963 | } |
6993 | 6964 | ||
6994 | done: | 6965 | done: |
6995 | up(&priv->action_sem); | 6966 | up(&priv->action_sem); |
6996 | return err; | 6967 | return err; |
6997 | } | 6968 | } |
6998 | 6969 | ||
6999 | |||
7000 | static int ipw2100_wx_get_freq(struct net_device *dev, | 6970 | static int ipw2100_wx_get_freq(struct net_device *dev, |
7001 | struct iw_request_info *info, | 6971 | struct iw_request_info *info, |
7002 | union iwreq_data *wrqu, char *extra) | 6972 | union iwreq_data *wrqu, char *extra) |
@@ -7045,7 +7015,7 @@ static int ipw2100_wx_set_mode(struct net_device *dev, | |||
7045 | case IW_MODE_MONITOR: | 7015 | case IW_MODE_MONITOR: |
7046 | err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); | 7016 | err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); |
7047 | break; | 7017 | break; |
7048 | #endif /* CONFIG_IPW2100_MONITOR */ | 7018 | #endif /* CONFIG_IPW2100_MONITOR */ |
7049 | case IW_MODE_ADHOC: | 7019 | case IW_MODE_ADHOC: |
7050 | err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); | 7020 | err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); |
7051 | break; | 7021 | break; |
@@ -7056,9 +7026,9 @@ static int ipw2100_wx_set_mode(struct net_device *dev, | |||
7056 | break; | 7026 | break; |
7057 | } | 7027 | } |
7058 | 7028 | ||
7059 | done: | 7029 | done: |
7060 | up(&priv->action_sem); | 7030 | up(&priv->action_sem); |
7061 | return err; | 7031 | return err; |
7062 | } | 7032 | } |
7063 | 7033 | ||
7064 | static int ipw2100_wx_get_mode(struct net_device *dev, | 7034 | static int ipw2100_wx_get_mode(struct net_device *dev, |
@@ -7077,7 +7047,6 @@ static int ipw2100_wx_get_mode(struct net_device *dev, | |||
7077 | return 0; | 7047 | return 0; |
7078 | } | 7048 | } |
7079 | 7049 | ||
7080 | |||
7081 | #define POWER_MODES 5 | 7050 | #define POWER_MODES 5 |
7082 | 7051 | ||
7083 | /* Values are in microsecond */ | 7052 | /* Values are in microsecond */ |
@@ -7124,19 +7093,19 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7124 | /* ~5 Mb/s real (802.11b) */ | 7093 | /* ~5 Mb/s real (802.11b) */ |
7125 | range->throughput = 5 * 1000 * 1000; | 7094 | range->throughput = 5 * 1000 * 1000; |
7126 | 7095 | ||
7127 | // range->sensitivity; /* signal level threshold range */ | 7096 | // range->sensitivity; /* signal level threshold range */ |
7128 | 7097 | ||
7129 | range->max_qual.qual = 100; | 7098 | range->max_qual.qual = 100; |
7130 | /* TODO: Find real max RSSI and stick here */ | 7099 | /* TODO: Find real max RSSI and stick here */ |
7131 | range->max_qual.level = 0; | 7100 | range->max_qual.level = 0; |
7132 | range->max_qual.noise = 0; | 7101 | range->max_qual.noise = 0; |
7133 | range->max_qual.updated = 7; /* Updated all three */ | 7102 | range->max_qual.updated = 7; /* Updated all three */ |
7134 | 7103 | ||
7135 | range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ | 7104 | range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ |
7136 | /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ | 7105 | /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ |
7137 | range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; | 7106 | range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; |
7138 | range->avg_qual.noise = 0; | 7107 | range->avg_qual.noise = 0; |
7139 | range->avg_qual.updated = 7; /* Updated all three */ | 7108 | range->avg_qual.updated = 7; /* Updated all three */ |
7140 | 7109 | ||
7141 | range->num_bitrates = RATE_COUNT; | 7110 | range->num_bitrates = RATE_COUNT; |
7142 | 7111 | ||
@@ -7150,61 +7119,62 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7150 | range->max_frag = MAX_FRAG_THRESHOLD; | 7119 | range->max_frag = MAX_FRAG_THRESHOLD; |
7151 | 7120 | ||
7152 | range->min_pmp = period_duration[0]; /* Minimal PM period */ | 7121 | range->min_pmp = period_duration[0]; /* Minimal PM period */ |
7153 | range->max_pmp = period_duration[POWER_MODES-1];/* Maximal PM period */ | 7122 | range->max_pmp = period_duration[POWER_MODES - 1]; /* Maximal PM period */ |
7154 | range->min_pmt = timeout_duration[POWER_MODES-1]; /* Minimal PM timeout */ | 7123 | range->min_pmt = timeout_duration[POWER_MODES - 1]; /* Minimal PM timeout */ |
7155 | range->max_pmt = timeout_duration[0];/* Maximal PM timeout */ | 7124 | range->max_pmt = timeout_duration[0]; /* Maximal PM timeout */ |
7156 | 7125 | ||
7157 | /* How to decode max/min PM period */ | 7126 | /* How to decode max/min PM period */ |
7158 | range->pmp_flags = IW_POWER_PERIOD; | 7127 | range->pmp_flags = IW_POWER_PERIOD; |
7159 | /* How to decode max/min PM period */ | 7128 | /* How to decode max/min PM period */ |
7160 | range->pmt_flags = IW_POWER_TIMEOUT; | 7129 | range->pmt_flags = IW_POWER_TIMEOUT; |
7161 | /* What PM options are supported */ | 7130 | /* What PM options are supported */ |
7162 | range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; | 7131 | range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; |
7163 | 7132 | ||
7164 | range->encoding_size[0] = 5; | 7133 | range->encoding_size[0] = 5; |
7165 | range->encoding_size[1] = 13; /* Different token sizes */ | 7134 | range->encoding_size[1] = 13; /* Different token sizes */ |
7166 | range->num_encoding_sizes = 2; /* Number of entry in the list */ | 7135 | range->num_encoding_sizes = 2; /* Number of entry in the list */ |
7167 | range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ | 7136 | range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ |
7168 | // range->encoding_login_index; /* token index for login token */ | 7137 | // range->encoding_login_index; /* token index for login token */ |
7169 | 7138 | ||
7170 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | 7139 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
7171 | range->txpower_capa = IW_TXPOW_DBM; | 7140 | range->txpower_capa = IW_TXPOW_DBM; |
7172 | range->num_txpower = IW_MAX_TXPOWER; | 7141 | range->num_txpower = IW_MAX_TXPOWER; |
7173 | for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); i < IW_MAX_TXPOWER; | 7142 | for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); |
7174 | i++, level -= ((IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM) * 16) / | 7143 | i < IW_MAX_TXPOWER; |
7175 | (IW_MAX_TXPOWER - 1)) | 7144 | i++, level -= |
7145 | ((IPW_TX_POWER_MAX_DBM - | ||
7146 | IPW_TX_POWER_MIN_DBM) * 16) / (IW_MAX_TXPOWER - 1)) | ||
7176 | range->txpower[i] = level / 16; | 7147 | range->txpower[i] = level / 16; |
7177 | } else { | 7148 | } else { |
7178 | range->txpower_capa = 0; | 7149 | range->txpower_capa = 0; |
7179 | range->num_txpower = 0; | 7150 | range->num_txpower = 0; |
7180 | } | 7151 | } |
7181 | 7152 | ||
7182 | |||
7183 | /* Set the Wireless Extension versions */ | 7153 | /* Set the Wireless Extension versions */ |
7184 | range->we_version_compiled = WIRELESS_EXT; | 7154 | range->we_version_compiled = WIRELESS_EXT; |
7185 | range->we_version_source = 16; | 7155 | range->we_version_source = 16; |
7186 | 7156 | ||
7187 | // range->retry_capa; /* What retry options are supported */ | 7157 | // range->retry_capa; /* What retry options are supported */ |
7188 | // range->retry_flags; /* How to decode max/min retry limit */ | 7158 | // range->retry_flags; /* How to decode max/min retry limit */ |
7189 | // range->r_time_flags; /* How to decode max/min retry life */ | 7159 | // range->r_time_flags; /* How to decode max/min retry life */ |
7190 | // range->min_retry; /* Minimal number of retries */ | 7160 | // range->min_retry; /* Minimal number of retries */ |
7191 | // range->max_retry; /* Maximal number of retries */ | 7161 | // range->max_retry; /* Maximal number of retries */ |
7192 | // range->min_r_time; /* Minimal retry lifetime */ | 7162 | // range->min_r_time; /* Minimal retry lifetime */ |
7193 | // range->max_r_time; /* Maximal retry lifetime */ | 7163 | // range->max_r_time; /* Maximal retry lifetime */ |
7194 | 7164 | ||
7195 | range->num_channels = FREQ_COUNT; | 7165 | range->num_channels = FREQ_COUNT; |
7196 | 7166 | ||
7197 | val = 0; | 7167 | val = 0; |
7198 | for (i = 0; i < FREQ_COUNT; i++) { | 7168 | for (i = 0; i < FREQ_COUNT; i++) { |
7199 | // TODO: Include only legal frequencies for some countries | 7169 | // TODO: Include only legal frequencies for some countries |
7200 | // if (local->channel_mask & (1 << i)) { | 7170 | // if (local->channel_mask & (1 << i)) { |
7201 | range->freq[val].i = i + 1; | 7171 | range->freq[val].i = i + 1; |
7202 | range->freq[val].m = ipw2100_frequencies[i] * 100000; | 7172 | range->freq[val].m = ipw2100_frequencies[i] * 100000; |
7203 | range->freq[val].e = 1; | 7173 | range->freq[val].e = 1; |
7204 | val++; | 7174 | val++; |
7205 | // } | 7175 | // } |
7206 | if (val == IW_MAX_FREQUENCIES) | 7176 | if (val == IW_MAX_FREQUENCIES) |
7207 | break; | 7177 | break; |
7208 | } | 7178 | } |
7209 | range->num_frequency = val; | 7179 | range->num_frequency = val; |
7210 | 7180 | ||
@@ -7259,7 +7229,7 @@ static int ipw2100_wx_set_wap(struct net_device *dev, | |||
7259 | wrqu->ap_addr.sa_data[4] & 0xff, | 7229 | wrqu->ap_addr.sa_data[4] & 0xff, |
7260 | wrqu->ap_addr.sa_data[5] & 0xff); | 7230 | wrqu->ap_addr.sa_data[5] & 0xff); |
7261 | 7231 | ||
7262 | done: | 7232 | done: |
7263 | up(&priv->action_sem); | 7233 | up(&priv->action_sem); |
7264 | return err; | 7234 | return err; |
7265 | } | 7235 | } |
@@ -7276,10 +7246,9 @@ static int ipw2100_wx_get_wap(struct net_device *dev, | |||
7276 | 7246 | ||
7277 | /* If we are associated, trying to associate, or have a statically | 7247 | /* If we are associated, trying to associate, or have a statically |
7278 | * configured BSSID then return that; otherwise return ANY */ | 7248 | * configured BSSID then return that; otherwise return ANY */ |
7279 | if (priv->config & CFG_STATIC_BSSID || | 7249 | if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) { |
7280 | priv->status & STATUS_ASSOCIATED) { | ||
7281 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; | 7250 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; |
7282 | memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); | 7251 | memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); |
7283 | } else | 7252 | } else |
7284 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); | 7253 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); |
7285 | 7254 | ||
@@ -7293,7 +7262,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, | |||
7293 | union iwreq_data *wrqu, char *extra) | 7262 | union iwreq_data *wrqu, char *extra) |
7294 | { | 7263 | { |
7295 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7264 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7296 | char *essid = ""; /* ANY */ | 7265 | char *essid = ""; /* ANY */ |
7297 | int length = 0; | 7266 | int length = 0; |
7298 | int err = 0; | 7267 | int err = 0; |
7299 | 7268 | ||
@@ -7333,7 +7302,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, | |||
7333 | 7302 | ||
7334 | err = ipw2100_set_essid(priv, essid, length, 0); | 7303 | err = ipw2100_set_essid(priv, essid, length, 0); |
7335 | 7304 | ||
7336 | done: | 7305 | done: |
7337 | up(&priv->action_sem); | 7306 | up(&priv->action_sem); |
7338 | return err; | 7307 | return err; |
7339 | } | 7308 | } |
@@ -7350,17 +7319,16 @@ static int ipw2100_wx_get_essid(struct net_device *dev, | |||
7350 | 7319 | ||
7351 | /* If we are associated, trying to associate, or have a statically | 7320 | /* If we are associated, trying to associate, or have a statically |
7352 | * configured ESSID then return that; otherwise return ANY */ | 7321 | * configured ESSID then return that; otherwise return ANY */ |
7353 | if (priv->config & CFG_STATIC_ESSID || | 7322 | if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { |
7354 | priv->status & STATUS_ASSOCIATED) { | ||
7355 | IPW_DEBUG_WX("Getting essid: '%s'\n", | 7323 | IPW_DEBUG_WX("Getting essid: '%s'\n", |
7356 | escape_essid(priv->essid, priv->essid_len)); | 7324 | escape_essid(priv->essid, priv->essid_len)); |
7357 | memcpy(extra, priv->essid, priv->essid_len); | 7325 | memcpy(extra, priv->essid, priv->essid_len); |
7358 | wrqu->essid.length = priv->essid_len; | 7326 | wrqu->essid.length = priv->essid_len; |
7359 | wrqu->essid.flags = 1; /* active */ | 7327 | wrqu->essid.flags = 1; /* active */ |
7360 | } else { | 7328 | } else { |
7361 | IPW_DEBUG_WX("Getting essid: ANY\n"); | 7329 | IPW_DEBUG_WX("Getting essid: ANY\n"); |
7362 | wrqu->essid.length = 0; | 7330 | wrqu->essid.length = 0; |
7363 | wrqu->essid.flags = 0; /* active */ | 7331 | wrqu->essid.flags = 0; /* active */ |
7364 | } | 7332 | } |
7365 | 7333 | ||
7366 | return 0; | 7334 | return 0; |
@@ -7379,9 +7347,9 @@ static int ipw2100_wx_set_nick(struct net_device *dev, | |||
7379 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) | 7347 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) |
7380 | return -E2BIG; | 7348 | return -E2BIG; |
7381 | 7349 | ||
7382 | wrqu->data.length = min((size_t)wrqu->data.length, sizeof(priv->nick)); | 7350 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); |
7383 | memset(priv->nick, 0, sizeof(priv->nick)); | 7351 | memset(priv->nick, 0, sizeof(priv->nick)); |
7384 | memcpy(priv->nick, extra, wrqu->data.length); | 7352 | memcpy(priv->nick, extra, wrqu->data.length); |
7385 | 7353 | ||
7386 | IPW_DEBUG_WX("SET Nickname -> %s \n", priv->nick); | 7354 | IPW_DEBUG_WX("SET Nickname -> %s \n", priv->nick); |
7387 | 7355 | ||
@@ -7400,7 +7368,7 @@ static int ipw2100_wx_get_nick(struct net_device *dev, | |||
7400 | 7368 | ||
7401 | wrqu->data.length = strlen(priv->nick) + 1; | 7369 | wrqu->data.length = strlen(priv->nick) + 1; |
7402 | memcpy(extra, priv->nick, wrqu->data.length); | 7370 | memcpy(extra, priv->nick, wrqu->data.length); |
7403 | wrqu->data.flags = 1; /* active */ | 7371 | wrqu->data.flags = 1; /* active */ |
7404 | 7372 | ||
7405 | IPW_DEBUG_WX("GET Nickname -> %s \n", extra); | 7373 | IPW_DEBUG_WX("GET Nickname -> %s \n", extra); |
7406 | 7374 | ||
@@ -7442,12 +7410,11 @@ static int ipw2100_wx_set_rate(struct net_device *dev, | |||
7442 | err = ipw2100_set_tx_rates(priv, rate, 0); | 7410 | err = ipw2100_set_tx_rates(priv, rate, 0); |
7443 | 7411 | ||
7444 | IPW_DEBUG_WX("SET Rate -> %04X \n", rate); | 7412 | IPW_DEBUG_WX("SET Rate -> %04X \n", rate); |
7445 | done: | 7413 | done: |
7446 | up(&priv->action_sem); | 7414 | up(&priv->action_sem); |
7447 | return err; | 7415 | return err; |
7448 | } | 7416 | } |
7449 | 7417 | ||
7450 | |||
7451 | static int ipw2100_wx_get_rate(struct net_device *dev, | 7418 | static int ipw2100_wx_get_rate(struct net_device *dev, |
7452 | struct iw_request_info *info, | 7419 | struct iw_request_info *info, |
7453 | union iwreq_data *wrqu, char *extra) | 7420 | union iwreq_data *wrqu, char *extra) |
@@ -7495,7 +7462,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev, | |||
7495 | 7462 | ||
7496 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); | 7463 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); |
7497 | 7464 | ||
7498 | done: | 7465 | done: |
7499 | up(&priv->action_sem); | 7466 | up(&priv->action_sem); |
7500 | return err; | 7467 | return err; |
7501 | } | 7468 | } |
@@ -7520,8 +7487,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev, | |||
7520 | if (wrqu->rts.disabled) | 7487 | if (wrqu->rts.disabled) |
7521 | value = priv->rts_threshold | RTS_DISABLED; | 7488 | value = priv->rts_threshold | RTS_DISABLED; |
7522 | else { | 7489 | else { |
7523 | if (wrqu->rts.value < 1 || | 7490 | if (wrqu->rts.value < 1 || wrqu->rts.value > 2304) { |
7524 | wrqu->rts.value > 2304) { | ||
7525 | err = -EINVAL; | 7491 | err = -EINVAL; |
7526 | goto done; | 7492 | goto done; |
7527 | } | 7493 | } |
@@ -7531,7 +7497,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev, | |||
7531 | err = ipw2100_set_rts_threshold(priv, value); | 7497 | err = ipw2100_set_rts_threshold(priv, value); |
7532 | 7498 | ||
7533 | IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value); | 7499 | IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value); |
7534 | done: | 7500 | done: |
7535 | up(&priv->action_sem); | 7501 | up(&priv->action_sem); |
7536 | return err; | 7502 | return err; |
7537 | } | 7503 | } |
@@ -7547,7 +7513,7 @@ static int ipw2100_wx_get_rts(struct net_device *dev, | |||
7547 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7513 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7548 | 7514 | ||
7549 | wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; | 7515 | wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; |
7550 | wrqu->rts.fixed = 1; /* no auto select */ | 7516 | wrqu->rts.fixed = 1; /* no auto select */ |
7551 | 7517 | ||
7552 | /* If RTS is set to the default value, then it is disabled */ | 7518 | /* If RTS is set to the default value, then it is disabled */ |
7553 | wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; | 7519 | wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; |
@@ -7574,8 +7540,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, | |||
7574 | wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) | 7540 | wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) |
7575 | return -EINVAL; | 7541 | return -EINVAL; |
7576 | 7542 | ||
7577 | value = (wrqu->txpower.value - IPW_TX_POWER_MIN_DBM) * 16 / | 7543 | value = wrqu->txpower.value; |
7578 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); | ||
7579 | } | 7544 | } |
7580 | 7545 | ||
7581 | down(&priv->action_sem); | 7546 | down(&priv->action_sem); |
@@ -7588,7 +7553,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, | |||
7588 | 7553 | ||
7589 | IPW_DEBUG_WX("SET TX Power -> %d \n", value); | 7554 | IPW_DEBUG_WX("SET TX Power -> %d \n", value); |
7590 | 7555 | ||
7591 | done: | 7556 | done: |
7592 | up(&priv->action_sem); | 7557 | up(&priv->action_sem); |
7593 | return err; | 7558 | return err; |
7594 | } | 7559 | } |
@@ -7615,11 +7580,7 @@ static int ipw2100_wx_get_txpow(struct net_device *dev, | |||
7615 | } else { | 7580 | } else { |
7616 | wrqu->power.disabled = 0; | 7581 | wrqu->power.disabled = 0; |
7617 | wrqu->power.fixed = 1; | 7582 | wrqu->power.fixed = 1; |
7618 | wrqu->power.value = | 7583 | wrqu->power.value = priv->tx_power; |
7619 | (priv->tx_power * | ||
7620 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM)) / | ||
7621 | (IPW_TX_POWER_MAX - IPW_TX_POWER_MIN) + | ||
7622 | IPW_TX_POWER_MIN_DBM; | ||
7623 | } | 7584 | } |
7624 | 7585 | ||
7625 | wrqu->power.flags = IW_TXPOW_DBM; | 7586 | wrqu->power.flags = IW_TXPOW_DBM; |
@@ -7684,8 +7645,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev, | |||
7684 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7645 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7685 | int err = 0; | 7646 | int err = 0; |
7686 | 7647 | ||
7687 | if (wrqu->retry.flags & IW_RETRY_LIFETIME || | 7648 | if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) |
7688 | wrqu->retry.disabled) | ||
7689 | return -EINVAL; | 7649 | return -EINVAL; |
7690 | 7650 | ||
7691 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) | 7651 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) |
@@ -7700,14 +7660,14 @@ static int ipw2100_wx_set_retry(struct net_device *dev, | |||
7700 | if (wrqu->retry.flags & IW_RETRY_MIN) { | 7660 | if (wrqu->retry.flags & IW_RETRY_MIN) { |
7701 | err = ipw2100_set_short_retry(priv, wrqu->retry.value); | 7661 | err = ipw2100_set_short_retry(priv, wrqu->retry.value); |
7702 | IPW_DEBUG_WX("SET Short Retry Limit -> %d \n", | 7662 | IPW_DEBUG_WX("SET Short Retry Limit -> %d \n", |
7703 | wrqu->retry.value); | 7663 | wrqu->retry.value); |
7704 | goto done; | 7664 | goto done; |
7705 | } | 7665 | } |
7706 | 7666 | ||
7707 | if (wrqu->retry.flags & IW_RETRY_MAX) { | 7667 | if (wrqu->retry.flags & IW_RETRY_MAX) { |
7708 | err = ipw2100_set_long_retry(priv, wrqu->retry.value); | 7668 | err = ipw2100_set_long_retry(priv, wrqu->retry.value); |
7709 | IPW_DEBUG_WX("SET Long Retry Limit -> %d \n", | 7669 | IPW_DEBUG_WX("SET Long Retry Limit -> %d \n", |
7710 | wrqu->retry.value); | 7670 | wrqu->retry.value); |
7711 | goto done; | 7671 | goto done; |
7712 | } | 7672 | } |
7713 | 7673 | ||
@@ -7717,7 +7677,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev, | |||
7717 | 7677 | ||
7718 | IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value); | 7678 | IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value); |
7719 | 7679 | ||
7720 | done: | 7680 | done: |
7721 | up(&priv->action_sem); | 7681 | up(&priv->action_sem); |
7722 | return err; | 7682 | return err; |
7723 | } | 7683 | } |
@@ -7732,20 +7692,19 @@ static int ipw2100_wx_get_retry(struct net_device *dev, | |||
7732 | 7692 | ||
7733 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7693 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7734 | 7694 | ||
7735 | wrqu->retry.disabled = 0; /* can't be disabled */ | 7695 | wrqu->retry.disabled = 0; /* can't be disabled */ |
7736 | 7696 | ||
7737 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == | 7697 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) |
7738 | IW_RETRY_LIFETIME) | ||
7739 | return -EINVAL; | 7698 | return -EINVAL; |
7740 | 7699 | ||
7741 | if (wrqu->retry.flags & IW_RETRY_MAX) { | 7700 | if (wrqu->retry.flags & IW_RETRY_MAX) { |
7742 | wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX; | 7701 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; |
7743 | wrqu->retry.value = priv->long_retry_limit; | 7702 | wrqu->retry.value = priv->long_retry_limit; |
7744 | } else { | 7703 | } else { |
7745 | wrqu->retry.flags = | 7704 | wrqu->retry.flags = |
7746 | (priv->short_retry_limit != | 7705 | (priv->short_retry_limit != |
7747 | priv->long_retry_limit) ? | 7706 | priv->long_retry_limit) ? |
7748 | IW_RETRY_LIMIT & IW_RETRY_MIN : IW_RETRY_LIMIT; | 7707 | IW_RETRY_LIMIT | IW_RETRY_MIN : IW_RETRY_LIMIT; |
7749 | 7708 | ||
7750 | wrqu->retry.value = priv->short_retry_limit; | 7709 | wrqu->retry.value = priv->short_retry_limit; |
7751 | } | 7710 | } |
@@ -7769,15 +7728,14 @@ static int ipw2100_wx_set_scan(struct net_device *dev, | |||
7769 | } | 7728 | } |
7770 | 7729 | ||
7771 | IPW_DEBUG_WX("Initiating scan...\n"); | 7730 | IPW_DEBUG_WX("Initiating scan...\n"); |
7772 | if (ipw2100_set_scan_options(priv) || | 7731 | if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { |
7773 | ipw2100_start_scan(priv)) { | ||
7774 | IPW_DEBUG_WX("Start scan failed.\n"); | 7732 | IPW_DEBUG_WX("Start scan failed.\n"); |
7775 | 7733 | ||
7776 | /* TODO: Mark a scan as pending so when hardware initialized | 7734 | /* TODO: Mark a scan as pending so when hardware initialized |
7777 | * a scan starts */ | 7735 | * a scan starts */ |
7778 | } | 7736 | } |
7779 | 7737 | ||
7780 | done: | 7738 | done: |
7781 | up(&priv->action_sem); | 7739 | up(&priv->action_sem); |
7782 | return err; | 7740 | return err; |
7783 | } | 7741 | } |
@@ -7794,7 +7752,6 @@ static int ipw2100_wx_get_scan(struct net_device *dev, | |||
7794 | return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra); | 7752 | return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra); |
7795 | } | 7753 | } |
7796 | 7754 | ||
7797 | |||
7798 | /* | 7755 | /* |
7799 | * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c | 7756 | * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c |
7800 | */ | 7757 | */ |
@@ -7823,8 +7780,8 @@ static int ipw2100_wx_get_encode(struct net_device *dev, | |||
7823 | } | 7780 | } |
7824 | 7781 | ||
7825 | static int ipw2100_wx_set_power(struct net_device *dev, | 7782 | static int ipw2100_wx_set_power(struct net_device *dev, |
7826 | struct iw_request_info *info, | 7783 | struct iw_request_info *info, |
7827 | union iwreq_data *wrqu, char *extra) | 7784 | union iwreq_data *wrqu, char *extra) |
7828 | { | 7785 | { |
7829 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7786 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7830 | int err = 0; | 7787 | int err = 0; |
@@ -7843,11 +7800,11 @@ static int ipw2100_wx_set_power(struct net_device *dev, | |||
7843 | } | 7800 | } |
7844 | 7801 | ||
7845 | switch (wrqu->power.flags & IW_POWER_MODE) { | 7802 | switch (wrqu->power.flags & IW_POWER_MODE) { |
7846 | case IW_POWER_ON: /* If not specified */ | 7803 | case IW_POWER_ON: /* If not specified */ |
7847 | case IW_POWER_MODE: /* If set all mask */ | 7804 | case IW_POWER_MODE: /* If set all mask */ |
7848 | case IW_POWER_ALL_R: /* If explicitely state all */ | 7805 | case IW_POWER_ALL_R: /* If explicitely state all */ |
7849 | break; | 7806 | break; |
7850 | default: /* Otherwise we don't support it */ | 7807 | default: /* Otherwise we don't support it */ |
7851 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", | 7808 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", |
7852 | wrqu->power.flags); | 7809 | wrqu->power.flags); |
7853 | err = -EOPNOTSUPP; | 7810 | err = -EOPNOTSUPP; |
@@ -7859,18 +7816,17 @@ static int ipw2100_wx_set_power(struct net_device *dev, | |||
7859 | priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; | 7816 | priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; |
7860 | err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); | 7817 | err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); |
7861 | 7818 | ||
7862 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", | 7819 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); |
7863 | priv->power_mode); | ||
7864 | 7820 | ||
7865 | done: | 7821 | done: |
7866 | up(&priv->action_sem); | 7822 | up(&priv->action_sem); |
7867 | return err; | 7823 | return err; |
7868 | 7824 | ||
7869 | } | 7825 | } |
7870 | 7826 | ||
7871 | static int ipw2100_wx_get_power(struct net_device *dev, | 7827 | static int ipw2100_wx_get_power(struct net_device *dev, |
7872 | struct iw_request_info *info, | 7828 | struct iw_request_info *info, |
7873 | union iwreq_data *wrqu, char *extra) | 7829 | union iwreq_data *wrqu, char *extra) |
7874 | { | 7830 | { |
7875 | /* | 7831 | /* |
7876 | * This can be called at any time. No action lock required | 7832 | * This can be called at any time. No action lock required |
@@ -7878,9 +7834,9 @@ static int ipw2100_wx_get_power(struct net_device *dev, | |||
7878 | 7834 | ||
7879 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7835 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7880 | 7836 | ||
7881 | if (!(priv->power_mode & IPW_POWER_ENABLED)) { | 7837 | if (!(priv->power_mode & IPW_POWER_ENABLED)) |
7882 | wrqu->power.disabled = 1; | 7838 | wrqu->power.disabled = 1; |
7883 | } else { | 7839 | else { |
7884 | wrqu->power.disabled = 0; | 7840 | wrqu->power.disabled = 0; |
7885 | wrqu->power.flags = 0; | 7841 | wrqu->power.flags = 0; |
7886 | } | 7842 | } |
@@ -7890,6 +7846,269 @@ static int ipw2100_wx_get_power(struct net_device *dev, | |||
7890 | return 0; | 7846 | return 0; |
7891 | } | 7847 | } |
7892 | 7848 | ||
7849 | #if WIRELESS_EXT > 17 | ||
7850 | /* | ||
7851 | * WE-18 WPA support | ||
7852 | */ | ||
7853 | |||
7854 | /* SIOCSIWGENIE */ | ||
7855 | static int ipw2100_wx_set_genie(struct net_device *dev, | ||
7856 | struct iw_request_info *info, | ||
7857 | union iwreq_data *wrqu, char *extra) | ||
7858 | { | ||
7859 | |||
7860 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
7861 | struct ieee80211_device *ieee = priv->ieee; | ||
7862 | u8 *buf; | ||
7863 | |||
7864 | if (!ieee->wpa_enabled) | ||
7865 | return -EOPNOTSUPP; | ||
7866 | |||
7867 | if (wrqu->data.length > MAX_WPA_IE_LEN || | ||
7868 | (wrqu->data.length && extra == NULL)) | ||
7869 | return -EINVAL; | ||
7870 | |||
7871 | if (wrqu->data.length) { | ||
7872 | buf = kmalloc(wrqu->data.length, GFP_KERNEL); | ||
7873 | if (buf == NULL) | ||
7874 | return -ENOMEM; | ||
7875 | |||
7876 | memcpy(buf, extra, wrqu->data.length); | ||
7877 | kfree(ieee->wpa_ie); | ||
7878 | ieee->wpa_ie = buf; | ||
7879 | ieee->wpa_ie_len = wrqu->data.length; | ||
7880 | } else { | ||
7881 | kfree(ieee->wpa_ie); | ||
7882 | ieee->wpa_ie = NULL; | ||
7883 | ieee->wpa_ie_len = 0; | ||
7884 | } | ||
7885 | |||
7886 | ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); | ||
7887 | |||
7888 | return 0; | ||
7889 | } | ||
7890 | |||
7891 | /* SIOCGIWGENIE */ | ||
7892 | static int ipw2100_wx_get_genie(struct net_device *dev, | ||
7893 | struct iw_request_info *info, | ||
7894 | union iwreq_data *wrqu, char *extra) | ||
7895 | { | ||
7896 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
7897 | struct ieee80211_device *ieee = priv->ieee; | ||
7898 | |||
7899 | if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { | ||
7900 | wrqu->data.length = 0; | ||
7901 | return 0; | ||
7902 | } | ||
7903 | |||
7904 | if (wrqu->data.length < ieee->wpa_ie_len) | ||
7905 | return -E2BIG; | ||
7906 | |||
7907 | wrqu->data.length = ieee->wpa_ie_len; | ||
7908 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); | ||
7909 | |||
7910 | return 0; | ||
7911 | } | ||
7912 | |||
7913 | /* SIOCSIWAUTH */ | ||
7914 | static int ipw2100_wx_set_auth(struct net_device *dev, | ||
7915 | struct iw_request_info *info, | ||
7916 | union iwreq_data *wrqu, char *extra) | ||
7917 | { | ||
7918 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
7919 | struct ieee80211_device *ieee = priv->ieee; | ||
7920 | struct iw_param *param = &wrqu->param; | ||
7921 | struct ieee80211_crypt_data *crypt; | ||
7922 | unsigned long flags; | ||
7923 | int ret = 0; | ||
7924 | |||
7925 | switch (param->flags & IW_AUTH_INDEX) { | ||
7926 | case IW_AUTH_WPA_VERSION: | ||
7927 | case IW_AUTH_CIPHER_PAIRWISE: | ||
7928 | case IW_AUTH_CIPHER_GROUP: | ||
7929 | case IW_AUTH_KEY_MGMT: | ||
7930 | /* | ||
7931 | * ipw2200 does not use these parameters | ||
7932 | */ | ||
7933 | break; | ||
7934 | |||
7935 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
7936 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
7937 | if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) | ||
7938 | break; | ||
7939 | |||
7940 | flags = crypt->ops->get_flags(crypt->priv); | ||
7941 | |||
7942 | if (param->value) | ||
7943 | flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
7944 | else | ||
7945 | flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
7946 | |||
7947 | crypt->ops->set_flags(flags, crypt->priv); | ||
7948 | |||
7949 | break; | ||
7950 | |||
7951 | case IW_AUTH_DROP_UNENCRYPTED:{ | ||
7952 | /* HACK: | ||
7953 | * | ||
7954 | * wpa_supplicant calls set_wpa_enabled when the driver | ||
7955 | * is loaded and unloaded, regardless of if WPA is being | ||
7956 | * used. No other calls are made which can be used to | ||
7957 | * determine if encryption will be used or not prior to | ||
7958 | * association being expected. If encryption is not being | ||
7959 | * used, drop_unencrypted is set to false, else true -- we | ||
7960 | * can use this to determine if the CAP_PRIVACY_ON bit should | ||
7961 | * be set. | ||
7962 | */ | ||
7963 | struct ieee80211_security sec = { | ||
7964 | .flags = SEC_ENABLED, | ||
7965 | .enabled = param->value, | ||
7966 | }; | ||
7967 | priv->ieee->drop_unencrypted = param->value; | ||
7968 | /* We only change SEC_LEVEL for open mode. Others | ||
7969 | * are set by ipw_wpa_set_encryption. | ||
7970 | */ | ||
7971 | if (!param->value) { | ||
7972 | sec.flags |= SEC_LEVEL; | ||
7973 | sec.level = SEC_LEVEL_0; | ||
7974 | } else { | ||
7975 | sec.flags |= SEC_LEVEL; | ||
7976 | sec.level = SEC_LEVEL_1; | ||
7977 | } | ||
7978 | if (priv->ieee->set_security) | ||
7979 | priv->ieee->set_security(priv->ieee->dev, &sec); | ||
7980 | break; | ||
7981 | } | ||
7982 | |||
7983 | case IW_AUTH_80211_AUTH_ALG: | ||
7984 | ret = ipw2100_wpa_set_auth_algs(priv, param->value); | ||
7985 | break; | ||
7986 | |||
7987 | case IW_AUTH_WPA_ENABLED: | ||
7988 | ret = ipw2100_wpa_enable(priv, param->value); | ||
7989 | break; | ||
7990 | |||
7991 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
7992 | ieee->ieee802_1x = param->value; | ||
7993 | break; | ||
7994 | |||
7995 | //case IW_AUTH_ROAMING_CONTROL: | ||
7996 | case IW_AUTH_PRIVACY_INVOKED: | ||
7997 | ieee->privacy_invoked = param->value; | ||
7998 | break; | ||
7999 | |||
8000 | default: | ||
8001 | return -EOPNOTSUPP; | ||
8002 | } | ||
8003 | return ret; | ||
8004 | } | ||
8005 | |||
8006 | /* SIOCGIWAUTH */ | ||
8007 | static int ipw2100_wx_get_auth(struct net_device *dev, | ||
8008 | struct iw_request_info *info, | ||
8009 | union iwreq_data *wrqu, char *extra) | ||
8010 | { | ||
8011 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
8012 | struct ieee80211_device *ieee = priv->ieee; | ||
8013 | struct ieee80211_crypt_data *crypt; | ||
8014 | struct iw_param *param = &wrqu->param; | ||
8015 | int ret = 0; | ||
8016 | |||
8017 | switch (param->flags & IW_AUTH_INDEX) { | ||
8018 | case IW_AUTH_WPA_VERSION: | ||
8019 | case IW_AUTH_CIPHER_PAIRWISE: | ||
8020 | case IW_AUTH_CIPHER_GROUP: | ||
8021 | case IW_AUTH_KEY_MGMT: | ||
8022 | /* | ||
8023 | * wpa_supplicant will control these internally | ||
8024 | */ | ||
8025 | ret = -EOPNOTSUPP; | ||
8026 | break; | ||
8027 | |||
8028 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
8029 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
8030 | if (!crypt || !crypt->ops->get_flags) { | ||
8031 | IPW_DEBUG_WARNING("Can't get TKIP countermeasures: " | ||
8032 | "crypt not set!\n"); | ||
8033 | break; | ||
8034 | } | ||
8035 | |||
8036 | param->value = (crypt->ops->get_flags(crypt->priv) & | ||
8037 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; | ||
8038 | |||
8039 | break; | ||
8040 | |||
8041 | case IW_AUTH_DROP_UNENCRYPTED: | ||
8042 | param->value = ieee->drop_unencrypted; | ||
8043 | break; | ||
8044 | |||
8045 | case IW_AUTH_80211_AUTH_ALG: | ||
8046 | param->value = priv->ieee->sec.auth_mode; | ||
8047 | break; | ||
8048 | |||
8049 | case IW_AUTH_WPA_ENABLED: | ||
8050 | param->value = ieee->wpa_enabled; | ||
8051 | break; | ||
8052 | |||
8053 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
8054 | param->value = ieee->ieee802_1x; | ||
8055 | break; | ||
8056 | |||
8057 | case IW_AUTH_ROAMING_CONTROL: | ||
8058 | case IW_AUTH_PRIVACY_INVOKED: | ||
8059 | param->value = ieee->privacy_invoked; | ||
8060 | break; | ||
8061 | |||
8062 | default: | ||
8063 | return -EOPNOTSUPP; | ||
8064 | } | ||
8065 | return 0; | ||
8066 | } | ||
8067 | |||
8068 | /* SIOCSIWENCODEEXT */ | ||
8069 | static int ipw2100_wx_set_encodeext(struct net_device *dev, | ||
8070 | struct iw_request_info *info, | ||
8071 | union iwreq_data *wrqu, char *extra) | ||
8072 | { | ||
8073 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
8074 | return ieee80211_wx_set_encodeext(priv->ieee, info, wrqu, extra); | ||
8075 | } | ||
8076 | |||
8077 | /* SIOCGIWENCODEEXT */ | ||
8078 | static int ipw2100_wx_get_encodeext(struct net_device *dev, | ||
8079 | struct iw_request_info *info, | ||
8080 | union iwreq_data *wrqu, char *extra) | ||
8081 | { | ||
8082 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
8083 | return ieee80211_wx_get_encodeext(priv->ieee, info, wrqu, extra); | ||
8084 | } | ||
8085 | |||
8086 | /* SIOCSIWMLME */ | ||
8087 | static int ipw2100_wx_set_mlme(struct net_device *dev, | ||
8088 | struct iw_request_info *info, | ||
8089 | union iwreq_data *wrqu, char *extra) | ||
8090 | { | ||
8091 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
8092 | struct iw_mlme *mlme = (struct iw_mlme *)extra; | ||
8093 | u16 reason; | ||
8094 | |||
8095 | reason = cpu_to_le16(mlme->reason_code); | ||
8096 | |||
8097 | switch (mlme->cmd) { | ||
8098 | case IW_MLME_DEAUTH: | ||
8099 | // silently ignore | ||
8100 | break; | ||
8101 | |||
8102 | case IW_MLME_DISASSOC: | ||
8103 | ipw2100_disassociate_bssid(priv); | ||
8104 | break; | ||
8105 | |||
8106 | default: | ||
8107 | return -EOPNOTSUPP; | ||
8108 | } | ||
8109 | return 0; | ||
8110 | } | ||
8111 | #endif /* WIRELESS_EXT > 17 */ | ||
7893 | 8112 | ||
7894 | /* | 8113 | /* |
7895 | * | 8114 | * |
@@ -7923,7 +8142,7 @@ static int ipw2100_wx_set_promisc(struct net_device *dev, | |||
7923 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) | 8142 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) |
7924 | err = ipw2100_switch_mode(priv, priv->last_mode); | 8143 | err = ipw2100_switch_mode(priv, priv->last_mode); |
7925 | } | 8144 | } |
7926 | done: | 8145 | done: |
7927 | up(&priv->action_sem); | 8146 | up(&priv->action_sem); |
7928 | return err; | 8147 | return err; |
7929 | } | 8148 | } |
@@ -7958,7 +8177,7 @@ static int ipw2100_wx_set_powermode(struct net_device *dev, | |||
7958 | 8177 | ||
7959 | if (priv->power_mode != mode) | 8178 | if (priv->power_mode != mode) |
7960 | err = ipw2100_set_power_mode(priv, mode); | 8179 | err = ipw2100_set_power_mode(priv, mode); |
7961 | done: | 8180 | done: |
7962 | up(&priv->action_sem); | 8181 | up(&priv->action_sem); |
7963 | return err; | 8182 | return err; |
7964 | } | 8183 | } |
@@ -7986,8 +8205,8 @@ static int ipw2100_wx_get_powermode(struct net_device *dev, | |||
7986 | "Power save level: %d (None)", level); | 8205 | "Power save level: %d (None)", level); |
7987 | break; | 8206 | break; |
7988 | case IPW_POWER_AUTO: | 8207 | case IPW_POWER_AUTO: |
7989 | snprintf(extra, MAX_POWER_STRING, | 8208 | snprintf(extra, MAX_POWER_STRING, |
7990 | "Power save level: %d (Auto)", 0); | 8209 | "Power save level: %d (Auto)", 0); |
7991 | break; | 8210 | break; |
7992 | default: | 8211 | default: |
7993 | timeout = timeout_duration[level - 1] / 1000; | 8212 | timeout = timeout_duration[level - 1] / 1000; |
@@ -8004,7 +8223,6 @@ static int ipw2100_wx_get_powermode(struct net_device *dev, | |||
8004 | return 0; | 8223 | return 0; |
8005 | } | 8224 | } |
8006 | 8225 | ||
8007 | |||
8008 | static int ipw2100_wx_set_preamble(struct net_device *dev, | 8226 | static int ipw2100_wx_set_preamble(struct net_device *dev, |
8009 | struct iw_request_info *info, | 8227 | struct iw_request_info *info, |
8010 | union iwreq_data *wrqu, char *extra) | 8228 | union iwreq_data *wrqu, char *extra) |
@@ -8029,14 +8247,14 @@ static int ipw2100_wx_set_preamble(struct net_device *dev, | |||
8029 | 8247 | ||
8030 | err = ipw2100_system_config(priv, 0); | 8248 | err = ipw2100_system_config(priv, 0); |
8031 | 8249 | ||
8032 | done: | 8250 | done: |
8033 | up(&priv->action_sem); | 8251 | up(&priv->action_sem); |
8034 | return err; | 8252 | return err; |
8035 | } | 8253 | } |
8036 | 8254 | ||
8037 | static int ipw2100_wx_get_preamble(struct net_device *dev, | 8255 | static int ipw2100_wx_get_preamble(struct net_device *dev, |
8038 | struct iw_request_info *info, | 8256 | struct iw_request_info *info, |
8039 | union iwreq_data *wrqu, char *extra) | 8257 | union iwreq_data *wrqu, char *extra) |
8040 | { | 8258 | { |
8041 | /* | 8259 | /* |
8042 | * This can be called at any time. No action lock required | 8260 | * This can be called at any time. No action lock required |
@@ -8052,54 +8270,116 @@ static int ipw2100_wx_get_preamble(struct net_device *dev, | |||
8052 | return 0; | 8270 | return 0; |
8053 | } | 8271 | } |
8054 | 8272 | ||
8055 | static iw_handler ipw2100_wx_handlers[] = | 8273 | #ifdef CONFIG_IPW2100_MONITOR |
8056 | { | 8274 | static int ipw2100_wx_set_crc_check(struct net_device *dev, |
8057 | NULL, /* SIOCSIWCOMMIT */ | 8275 | struct iw_request_info *info, |
8058 | ipw2100_wx_get_name, /* SIOCGIWNAME */ | 8276 | union iwreq_data *wrqu, char *extra) |
8059 | NULL, /* SIOCSIWNWID */ | 8277 | { |
8060 | NULL, /* SIOCGIWNWID */ | 8278 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
8061 | ipw2100_wx_set_freq, /* SIOCSIWFREQ */ | 8279 | int err, mode = *(int *)extra; |
8062 | ipw2100_wx_get_freq, /* SIOCGIWFREQ */ | 8280 | |
8063 | ipw2100_wx_set_mode, /* SIOCSIWMODE */ | 8281 | down(&priv->action_sem); |
8064 | ipw2100_wx_get_mode, /* SIOCGIWMODE */ | 8282 | if (!(priv->status & STATUS_INITIALIZED)) { |
8065 | NULL, /* SIOCSIWSENS */ | 8283 | err = -EIO; |
8066 | NULL, /* SIOCGIWSENS */ | 8284 | goto done; |
8067 | NULL, /* SIOCSIWRANGE */ | 8285 | } |
8068 | ipw2100_wx_get_range, /* SIOCGIWRANGE */ | 8286 | |
8069 | NULL, /* SIOCSIWPRIV */ | 8287 | if (mode == 1) |
8070 | NULL, /* SIOCGIWPRIV */ | 8288 | priv->config |= CFG_CRC_CHECK; |
8071 | NULL, /* SIOCSIWSTATS */ | 8289 | else if (mode == 0) |
8072 | NULL, /* SIOCGIWSTATS */ | 8290 | priv->config &= ~CFG_CRC_CHECK; |
8073 | NULL, /* SIOCSIWSPY */ | 8291 | else { |
8074 | NULL, /* SIOCGIWSPY */ | 8292 | err = -EINVAL; |
8075 | NULL, /* SIOCGIWTHRSPY */ | 8293 | goto done; |
8076 | NULL, /* SIOCWIWTHRSPY */ | 8294 | } |
8077 | ipw2100_wx_set_wap, /* SIOCSIWAP */ | 8295 | err = 0; |
8078 | ipw2100_wx_get_wap, /* SIOCGIWAP */ | 8296 | |
8079 | NULL, /* -- hole -- */ | 8297 | done: |
8080 | NULL, /* SIOCGIWAPLIST -- deprecated */ | 8298 | up(&priv->action_sem); |
8081 | ipw2100_wx_set_scan, /* SIOCSIWSCAN */ | 8299 | return err; |
8082 | ipw2100_wx_get_scan, /* SIOCGIWSCAN */ | 8300 | } |
8083 | ipw2100_wx_set_essid, /* SIOCSIWESSID */ | 8301 | |
8084 | ipw2100_wx_get_essid, /* SIOCGIWESSID */ | 8302 | static int ipw2100_wx_get_crc_check(struct net_device *dev, |
8085 | ipw2100_wx_set_nick, /* SIOCSIWNICKN */ | 8303 | struct iw_request_info *info, |
8086 | ipw2100_wx_get_nick, /* SIOCGIWNICKN */ | 8304 | union iwreq_data *wrqu, char *extra) |
8087 | NULL, /* -- hole -- */ | 8305 | { |
8088 | NULL, /* -- hole -- */ | 8306 | /* |
8089 | ipw2100_wx_set_rate, /* SIOCSIWRATE */ | 8307 | * This can be called at any time. No action lock required |
8090 | ipw2100_wx_get_rate, /* SIOCGIWRATE */ | 8308 | */ |
8091 | ipw2100_wx_set_rts, /* SIOCSIWRTS */ | 8309 | |
8092 | ipw2100_wx_get_rts, /* SIOCGIWRTS */ | 8310 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
8093 | ipw2100_wx_set_frag, /* SIOCSIWFRAG */ | 8311 | |
8094 | ipw2100_wx_get_frag, /* SIOCGIWFRAG */ | 8312 | if (priv->config & CFG_CRC_CHECK) |
8095 | ipw2100_wx_set_txpow, /* SIOCSIWTXPOW */ | 8313 | snprintf(wrqu->name, IFNAMSIZ, "CRC checked (1)"); |
8096 | ipw2100_wx_get_txpow, /* SIOCGIWTXPOW */ | 8314 | else |
8097 | ipw2100_wx_set_retry, /* SIOCSIWRETRY */ | 8315 | snprintf(wrqu->name, IFNAMSIZ, "CRC ignored (0)"); |
8098 | ipw2100_wx_get_retry, /* SIOCGIWRETRY */ | 8316 | |
8099 | ipw2100_wx_set_encode, /* SIOCSIWENCODE */ | 8317 | return 0; |
8100 | ipw2100_wx_get_encode, /* SIOCGIWENCODE */ | 8318 | } |
8101 | ipw2100_wx_set_power, /* SIOCSIWPOWER */ | 8319 | #endif /* CONFIG_IPW2100_MONITOR */ |
8102 | ipw2100_wx_get_power, /* SIOCGIWPOWER */ | 8320 | |
8321 | static iw_handler ipw2100_wx_handlers[] = { | ||
8322 | NULL, /* SIOCSIWCOMMIT */ | ||
8323 | ipw2100_wx_get_name, /* SIOCGIWNAME */ | ||
8324 | NULL, /* SIOCSIWNWID */ | ||
8325 | NULL, /* SIOCGIWNWID */ | ||
8326 | ipw2100_wx_set_freq, /* SIOCSIWFREQ */ | ||
8327 | ipw2100_wx_get_freq, /* SIOCGIWFREQ */ | ||
8328 | ipw2100_wx_set_mode, /* SIOCSIWMODE */ | ||
8329 | ipw2100_wx_get_mode, /* SIOCGIWMODE */ | ||
8330 | NULL, /* SIOCSIWSENS */ | ||
8331 | NULL, /* SIOCGIWSENS */ | ||
8332 | NULL, /* SIOCSIWRANGE */ | ||
8333 | ipw2100_wx_get_range, /* SIOCGIWRANGE */ | ||
8334 | NULL, /* SIOCSIWPRIV */ | ||
8335 | NULL, /* SIOCGIWPRIV */ | ||
8336 | NULL, /* SIOCSIWSTATS */ | ||
8337 | NULL, /* SIOCGIWSTATS */ | ||
8338 | NULL, /* SIOCSIWSPY */ | ||
8339 | NULL, /* SIOCGIWSPY */ | ||
8340 | NULL, /* SIOCGIWTHRSPY */ | ||
8341 | NULL, /* SIOCWIWTHRSPY */ | ||
8342 | ipw2100_wx_set_wap, /* SIOCSIWAP */ | ||
8343 | ipw2100_wx_get_wap, /* SIOCGIWAP */ | ||
8344 | #if WIRELESS_EXT > 17 | ||
8345 | ipw2100_wx_set_mlme, /* SIOCSIWMLME */ | ||
8346 | #else | ||
8347 | NULL, /* -- hole -- */ | ||
8348 | #endif | ||
8349 | NULL, /* SIOCGIWAPLIST -- deprecated */ | ||
8350 | ipw2100_wx_set_scan, /* SIOCSIWSCAN */ | ||
8351 | ipw2100_wx_get_scan, /* SIOCGIWSCAN */ | ||
8352 | ipw2100_wx_set_essid, /* SIOCSIWESSID */ | ||
8353 | ipw2100_wx_get_essid, /* SIOCGIWESSID */ | ||
8354 | ipw2100_wx_set_nick, /* SIOCSIWNICKN */ | ||
8355 | ipw2100_wx_get_nick, /* SIOCGIWNICKN */ | ||
8356 | NULL, /* -- hole -- */ | ||
8357 | NULL, /* -- hole -- */ | ||
8358 | ipw2100_wx_set_rate, /* SIOCSIWRATE */ | ||
8359 | ipw2100_wx_get_rate, /* SIOCGIWRATE */ | ||
8360 | ipw2100_wx_set_rts, /* SIOCSIWRTS */ | ||
8361 | ipw2100_wx_get_rts, /* SIOCGIWRTS */ | ||
8362 | ipw2100_wx_set_frag, /* SIOCSIWFRAG */ | ||
8363 | ipw2100_wx_get_frag, /* SIOCGIWFRAG */ | ||
8364 | ipw2100_wx_set_txpow, /* SIOCSIWTXPOW */ | ||
8365 | ipw2100_wx_get_txpow, /* SIOCGIWTXPOW */ | ||
8366 | ipw2100_wx_set_retry, /* SIOCSIWRETRY */ | ||
8367 | ipw2100_wx_get_retry, /* SIOCGIWRETRY */ | ||
8368 | ipw2100_wx_set_encode, /* SIOCSIWENCODE */ | ||
8369 | ipw2100_wx_get_encode, /* SIOCGIWENCODE */ | ||
8370 | ipw2100_wx_set_power, /* SIOCSIWPOWER */ | ||
8371 | ipw2100_wx_get_power, /* SIOCGIWPOWER */ | ||
8372 | #if WIRELESS_EXT > 17 | ||
8373 | NULL, /* -- hole -- */ | ||
8374 | NULL, /* -- hole -- */ | ||
8375 | ipw2100_wx_set_genie, /* SIOCSIWGENIE */ | ||
8376 | ipw2100_wx_get_genie, /* SIOCGIWGENIE */ | ||
8377 | ipw2100_wx_set_auth, /* SIOCSIWAUTH */ | ||
8378 | ipw2100_wx_get_auth, /* SIOCGIWAUTH */ | ||
8379 | ipw2100_wx_set_encodeext, /* SIOCSIWENCODEEXT */ | ||
8380 | ipw2100_wx_get_encodeext, /* SIOCGIWENCODEEXT */ | ||
8381 | NULL, /* SIOCSIWPMKSA */ | ||
8382 | #endif | ||
8103 | }; | 8383 | }; |
8104 | 8384 | ||
8105 | #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV | 8385 | #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV |
@@ -8108,60 +8388,71 @@ static iw_handler ipw2100_wx_handlers[] = | |||
8108 | #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 | 8388 | #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 |
8109 | #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 | 8389 | #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 |
8110 | #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 | 8390 | #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 |
8391 | #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 | ||
8392 | #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 | ||
8111 | 8393 | ||
8112 | static const struct iw_priv_args ipw2100_private_args[] = { | 8394 | static const struct iw_priv_args ipw2100_private_args[] = { |
8113 | 8395 | ||
8114 | #ifdef CONFIG_IPW2100_MONITOR | 8396 | #ifdef CONFIG_IPW2100_MONITOR |
8115 | { | 8397 | { |
8116 | IPW2100_PRIV_SET_MONITOR, | 8398 | IPW2100_PRIV_SET_MONITOR, |
8117 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor" | 8399 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, |
8118 | }, | ||
8119 | { | 8400 | { |
8120 | IPW2100_PRIV_RESET, | 8401 | IPW2100_PRIV_RESET, |
8121 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset" | 8402 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, |
8122 | }, | 8403 | #endif /* CONFIG_IPW2100_MONITOR */ |
8123 | #endif /* CONFIG_IPW2100_MONITOR */ | ||
8124 | 8404 | ||
8125 | { | 8405 | { |
8126 | IPW2100_PRIV_SET_POWER, | 8406 | IPW2100_PRIV_SET_POWER, |
8127 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power" | 8407 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power"}, |
8128 | }, | ||
8129 | { | 8408 | { |
8130 | IPW2100_PRIV_GET_POWER, | 8409 | IPW2100_PRIV_GET_POWER, |
8131 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, "get_power" | 8410 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, |
8132 | }, | 8411 | "get_power"}, |
8133 | { | 8412 | { |
8134 | IPW2100_PRIV_SET_LONGPREAMBLE, | 8413 | IPW2100_PRIV_SET_LONGPREAMBLE, |
8135 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble" | 8414 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"}, |
8136 | }, | ||
8137 | { | 8415 | { |
8138 | IPW2100_PRIV_GET_LONGPREAMBLE, | 8416 | IPW2100_PRIV_GET_LONGPREAMBLE, |
8139 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble" | 8417 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble"}, |
8140 | }, | 8418 | #ifdef CONFIG_IPW2100_MONITOR |
8419 | { | ||
8420 | IPW2100_PRIV_SET_CRC_CHECK, | ||
8421 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_crc_check"}, | ||
8422 | { | ||
8423 | IPW2100_PRIV_GET_CRC_CHECK, | ||
8424 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_crc_check"}, | ||
8425 | #endif /* CONFIG_IPW2100_MONITOR */ | ||
8141 | }; | 8426 | }; |
8142 | 8427 | ||
8143 | static iw_handler ipw2100_private_handler[] = { | 8428 | static iw_handler ipw2100_private_handler[] = { |
8144 | #ifdef CONFIG_IPW2100_MONITOR | 8429 | #ifdef CONFIG_IPW2100_MONITOR |
8145 | ipw2100_wx_set_promisc, | 8430 | ipw2100_wx_set_promisc, |
8146 | ipw2100_wx_reset, | 8431 | ipw2100_wx_reset, |
8147 | #else /* CONFIG_IPW2100_MONITOR */ | 8432 | #else /* CONFIG_IPW2100_MONITOR */ |
8148 | NULL, | 8433 | NULL, |
8149 | NULL, | 8434 | NULL, |
8150 | #endif /* CONFIG_IPW2100_MONITOR */ | 8435 | #endif /* CONFIG_IPW2100_MONITOR */ |
8151 | ipw2100_wx_set_powermode, | 8436 | ipw2100_wx_set_powermode, |
8152 | ipw2100_wx_get_powermode, | 8437 | ipw2100_wx_get_powermode, |
8153 | ipw2100_wx_set_preamble, | 8438 | ipw2100_wx_set_preamble, |
8154 | ipw2100_wx_get_preamble, | 8439 | ipw2100_wx_get_preamble, |
8440 | #ifdef CONFIG_IPW2100_MONITOR | ||
8441 | ipw2100_wx_set_crc_check, | ||
8442 | ipw2100_wx_get_crc_check, | ||
8443 | #else /* CONFIG_IPW2100_MONITOR */ | ||
8444 | NULL, | ||
8445 | NULL, | ||
8446 | #endif /* CONFIG_IPW2100_MONITOR */ | ||
8155 | }; | 8447 | }; |
8156 | 8448 | ||
8157 | static struct iw_handler_def ipw2100_wx_handler_def = | 8449 | static struct iw_handler_def ipw2100_wx_handler_def = { |
8158 | { | ||
8159 | .standard = ipw2100_wx_handlers, | 8450 | .standard = ipw2100_wx_handlers, |
8160 | .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), | 8451 | .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), |
8161 | .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), | 8452 | .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), |
8162 | .num_private_args = sizeof(ipw2100_private_args) / | 8453 | .num_private_args = sizeof(ipw2100_private_args) / |
8163 | sizeof(struct iw_priv_args), | 8454 | sizeof(struct iw_priv_args), |
8164 | .private = (iw_handler *)ipw2100_private_handler, | 8455 | .private = (iw_handler *) ipw2100_private_handler, |
8165 | .private_args = (struct iw_priv_args *)ipw2100_private_args, | 8456 | .private_args = (struct iw_priv_args *)ipw2100_private_args, |
8166 | }; | 8457 | }; |
8167 | 8458 | ||
@@ -8170,7 +8461,7 @@ static struct iw_handler_def ipw2100_wx_handler_def = | |||
8170 | * Called by /proc/net/wireless | 8461 | * Called by /proc/net/wireless |
8171 | * Also called by SIOCGIWSTATS | 8462 | * Also called by SIOCGIWSTATS |
8172 | */ | 8463 | */ |
8173 | static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | 8464 | static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev) |
8174 | { | 8465 | { |
8175 | enum { | 8466 | enum { |
8176 | POOR = 30, | 8467 | POOR = 30, |
@@ -8190,7 +8481,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8190 | u32 ord_len = sizeof(u32); | 8481 | u32 ord_len = sizeof(u32); |
8191 | 8482 | ||
8192 | if (!priv) | 8483 | if (!priv) |
8193 | return (struct iw_statistics *) NULL; | 8484 | return (struct iw_statistics *)NULL; |
8194 | 8485 | ||
8195 | wstats = &priv->wstats; | 8486 | wstats = &priv->wstats; |
8196 | 8487 | ||
@@ -8207,7 +8498,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8207 | wstats->qual.noise = 0; | 8498 | wstats->qual.noise = 0; |
8208 | wstats->qual.updated = 7; | 8499 | wstats->qual.updated = 7; |
8209 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID | | 8500 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID | |
8210 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; | 8501 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; |
8211 | return wstats; | 8502 | return wstats; |
8212 | } | 8503 | } |
8213 | 8504 | ||
@@ -8215,7 +8506,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8215 | &missed_beacons, &ord_len)) | 8506 | &missed_beacons, &ord_len)) |
8216 | goto fail_get_ordinal; | 8507 | goto fail_get_ordinal; |
8217 | 8508 | ||
8218 | /* If we don't have a connection the quality and level is 0*/ | 8509 | /* If we don't have a connection the quality and level is 0 */ |
8219 | if (!(priv->status & STATUS_ASSOCIATED)) { | 8510 | if (!(priv->status & STATUS_ASSOCIATED)) { |
8220 | wstats->qual.qual = 0; | 8511 | wstats->qual.qual = 0; |
8221 | wstats->qual.level = 0; | 8512 | wstats->qual.level = 0; |
@@ -8232,10 +8523,10 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8232 | rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; | 8523 | rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; |
8233 | else if (rssi < 30) | 8524 | else if (rssi < 30) |
8234 | rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / | 8525 | rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / |
8235 | 10 + GOOD; | 8526 | 10 + GOOD; |
8236 | else | 8527 | else |
8237 | rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / | 8528 | rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / |
8238 | 10 + VERY_GOOD; | 8529 | 10 + VERY_GOOD; |
8239 | 8530 | ||
8240 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, | 8531 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, |
8241 | &tx_retries, &ord_len)) | 8532 | &tx_retries, &ord_len)) |
@@ -8249,25 +8540,25 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8249 | tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; | 8540 | tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; |
8250 | else if (tx_retries > 50) | 8541 | else if (tx_retries > 50) |
8251 | tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / | 8542 | tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / |
8252 | 15 + GOOD; | 8543 | 15 + GOOD; |
8253 | else | 8544 | else |
8254 | tx_qual = (50 - tx_retries) * | 8545 | tx_qual = (50 - tx_retries) * |
8255 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; | 8546 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; |
8256 | 8547 | ||
8257 | if (missed_beacons > 50) | 8548 | if (missed_beacons > 50) |
8258 | beacon_qual = (60 - missed_beacons) * POOR / 10; | 8549 | beacon_qual = (60 - missed_beacons) * POOR / 10; |
8259 | else if (missed_beacons > 40) | 8550 | else if (missed_beacons > 40) |
8260 | beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / | 8551 | beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / |
8261 | 10 + POOR; | 8552 | 10 + POOR; |
8262 | else if (missed_beacons > 32) | 8553 | else if (missed_beacons > 32) |
8263 | beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / | 8554 | beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / |
8264 | 18 + FAIR; | 8555 | 18 + FAIR; |
8265 | else if (missed_beacons > 20) | 8556 | else if (missed_beacons > 20) |
8266 | beacon_qual = (32 - missed_beacons) * | 8557 | beacon_qual = (32 - missed_beacons) * |
8267 | (VERY_GOOD - GOOD) / 20 + GOOD; | 8558 | (VERY_GOOD - GOOD) / 20 + GOOD; |
8268 | else | 8559 | else |
8269 | beacon_qual = (20 - missed_beacons) * | 8560 | beacon_qual = (20 - missed_beacons) * |
8270 | (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; | 8561 | (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; |
8271 | 8562 | ||
8272 | quality = min(beacon_qual, min(tx_qual, rssi_qual)); | 8563 | quality = min(beacon_qual, min(tx_qual, rssi_qual)); |
8273 | 8564 | ||
@@ -8290,7 +8581,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8290 | wstats->qual.updated = 7; | 8581 | wstats->qual.updated = 7; |
8291 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID; | 8582 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID; |
8292 | 8583 | ||
8293 | /* FIXME: this is percent and not a # */ | 8584 | /* FIXME: this is percent and not a # */ |
8294 | wstats->miss.beacon = missed_beacons; | 8585 | wstats->miss.beacon = missed_beacons; |
8295 | 8586 | ||
8296 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, | 8587 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, |
@@ -8300,10 +8591,10 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8300 | 8591 | ||
8301 | return wstats; | 8592 | return wstats; |
8302 | 8593 | ||
8303 | fail_get_ordinal: | 8594 | fail_get_ordinal: |
8304 | IPW_DEBUG_WX("failed querying ordinals.\n"); | 8595 | IPW_DEBUG_WX("failed querying ordinals.\n"); |
8305 | 8596 | ||
8306 | return (struct iw_statistics *) NULL; | 8597 | return (struct iw_statistics *)NULL; |
8307 | } | 8598 | } |
8308 | 8599 | ||
8309 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | 8600 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv) |
@@ -8326,23 +8617,17 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
8326 | if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || | 8617 | if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || |
8327 | priv->status & STATUS_RF_KILL_MASK || | 8618 | priv->status & STATUS_RF_KILL_MASK || |
8328 | ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, | 8619 | ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, |
8329 | &priv->bssid, &len)) { | 8620 | &priv->bssid, &len)) { |
8330 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); | 8621 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); |
8331 | } else { | 8622 | } else { |
8332 | /* We now have the BSSID, so can finish setting to the full | 8623 | /* We now have the BSSID, so can finish setting to the full |
8333 | * associated state */ | 8624 | * associated state */ |
8334 | memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); | 8625 | memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); |
8335 | memcpy(&priv->ieee->bssid, priv->bssid, ETH_ALEN); | 8626 | memcpy(priv->ieee->bssid, priv->bssid, ETH_ALEN); |
8336 | priv->status &= ~STATUS_ASSOCIATING; | 8627 | priv->status &= ~STATUS_ASSOCIATING; |
8337 | priv->status |= STATUS_ASSOCIATED; | 8628 | priv->status |= STATUS_ASSOCIATED; |
8338 | netif_carrier_on(priv->net_dev); | 8629 | netif_carrier_on(priv->net_dev); |
8339 | if (netif_queue_stopped(priv->net_dev)) { | 8630 | netif_wake_queue(priv->net_dev); |
8340 | IPW_DEBUG_INFO("Waking net queue.\n"); | ||
8341 | netif_wake_queue(priv->net_dev); | ||
8342 | } else { | ||
8343 | IPW_DEBUG_INFO("Starting net queue.\n"); | ||
8344 | netif_start_queue(priv->net_dev); | ||
8345 | } | ||
8346 | } | 8631 | } |
8347 | 8632 | ||
8348 | if (!(priv->status & STATUS_ASSOCIATED)) { | 8633 | if (!(priv->status & STATUS_ASSOCIATED)) { |
@@ -8351,7 +8636,8 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
8351 | /* This is a disassociation event, so kick the firmware to | 8636 | /* This is a disassociation event, so kick the firmware to |
8352 | * look for another AP */ | 8637 | * look for another AP */ |
8353 | if (priv->config & CFG_STATIC_ESSID) | 8638 | if (priv->config & CFG_STATIC_ESSID) |
8354 | ipw2100_set_essid(priv, priv->essid, priv->essid_len, 0); | 8639 | ipw2100_set_essid(priv, priv->essid, priv->essid_len, |
8640 | 0); | ||
8355 | else | 8641 | else |
8356 | ipw2100_set_essid(priv, NULL, 0, 0); | 8642 | ipw2100_set_essid(priv, NULL, 0, 0); |
8357 | up(&priv->action_sem); | 8643 | up(&priv->action_sem); |
@@ -8374,7 +8660,6 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
8374 | 8660 | ||
8375 | #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" | 8661 | #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" |
8376 | 8662 | ||
8377 | |||
8378 | /* | 8663 | /* |
8379 | 8664 | ||
8380 | BINARY FIRMWARE HEADER FORMAT | 8665 | BINARY FIRMWARE HEADER FORMAT |
@@ -8396,12 +8681,10 @@ struct ipw2100_fw_header { | |||
8396 | unsigned int uc_size; | 8681 | unsigned int uc_size; |
8397 | } __attribute__ ((packed)); | 8682 | } __attribute__ ((packed)); |
8398 | 8683 | ||
8399 | |||
8400 | |||
8401 | static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) | 8684 | static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) |
8402 | { | 8685 | { |
8403 | struct ipw2100_fw_header *h = | 8686 | struct ipw2100_fw_header *h = |
8404 | (struct ipw2100_fw_header *)fw->fw_entry->data; | 8687 | (struct ipw2100_fw_header *)fw->fw_entry->data; |
8405 | 8688 | ||
8406 | if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { | 8689 | if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { |
8407 | printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " | 8690 | printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " |
@@ -8420,7 +8703,6 @@ static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) | |||
8420 | return 0; | 8703 | return 0; |
8421 | } | 8704 | } |
8422 | 8705 | ||
8423 | |||
8424 | static int ipw2100_get_firmware(struct ipw2100_priv *priv, | 8706 | static int ipw2100_get_firmware(struct ipw2100_priv *priv, |
8425 | struct ipw2100_fw *fw) | 8707 | struct ipw2100_fw *fw) |
8426 | { | 8708 | { |
@@ -8428,7 +8710,7 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv, | |||
8428 | int rc; | 8710 | int rc; |
8429 | 8711 | ||
8430 | IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", | 8712 | IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", |
8431 | priv->net_dev->name); | 8713 | priv->net_dev->name); |
8432 | 8714 | ||
8433 | switch (priv->ieee->iw_mode) { | 8715 | switch (priv->ieee->iw_mode) { |
8434 | case IW_MODE_ADHOC: | 8716 | case IW_MODE_ADHOC: |
@@ -8454,7 +8736,7 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv, | |||
8454 | return rc; | 8736 | return rc; |
8455 | } | 8737 | } |
8456 | IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, | 8738 | IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, |
8457 | fw->fw_entry->size); | 8739 | fw->fw_entry->size); |
8458 | 8740 | ||
8459 | ipw2100_mod_firmware_load(fw); | 8741 | ipw2100_mod_firmware_load(fw); |
8460 | 8742 | ||
@@ -8470,7 +8752,6 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv, | |||
8470 | fw->fw_entry = NULL; | 8752 | fw->fw_entry = NULL; |
8471 | } | 8753 | } |
8472 | 8754 | ||
8473 | |||
8474 | static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, | 8755 | static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, |
8475 | size_t max) | 8756 | size_t max) |
8476 | { | 8757 | { |
@@ -8479,8 +8760,7 @@ static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, | |||
8479 | u32 tmp; | 8760 | u32 tmp; |
8480 | int i; | 8761 | int i; |
8481 | /* firmware version is an ascii string (max len of 14) */ | 8762 | /* firmware version is an ascii string (max len of 14) */ |
8482 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, | 8763 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, ver, &len)) |
8483 | ver, &len)) | ||
8484 | return -EIO; | 8764 | return -EIO; |
8485 | tmp = max; | 8765 | tmp = max; |
8486 | if (len >= max) | 8766 | if (len >= max) |
@@ -8497,8 +8777,7 @@ static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, | |||
8497 | u32 ver; | 8777 | u32 ver; |
8498 | u32 len = sizeof(ver); | 8778 | u32 len = sizeof(ver); |
8499 | /* microcode version is a 32 bit integer */ | 8779 | /* microcode version is a 32 bit integer */ |
8500 | if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, | 8780 | if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len)) |
8501 | &ver, &len)) | ||
8502 | return -EIO; | 8781 | return -EIO; |
8503 | return snprintf(buf, max, "%08X", ver); | 8782 | return snprintf(buf, max, "%08X", ver); |
8504 | } | 8783 | } |
@@ -8506,8 +8785,7 @@ static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, | |||
8506 | /* | 8785 | /* |
8507 | * On exit, the firmware will have been freed from the fw list | 8786 | * On exit, the firmware will have been freed from the fw list |
8508 | */ | 8787 | */ |
8509 | static int ipw2100_fw_download(struct ipw2100_priv *priv, | 8788 | static int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw) |
8510 | struct ipw2100_fw *fw) | ||
8511 | { | 8789 | { |
8512 | /* firmware is constructed of N contiguous entries, each entry is | 8790 | /* firmware is constructed of N contiguous entries, each entry is |
8513 | * structured as: | 8791 | * structured as: |
@@ -8515,7 +8793,7 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, | |||
8515 | * offset sie desc | 8793 | * offset sie desc |
8516 | * 0 4 address to write to | 8794 | * 0 4 address to write to |
8517 | * 4 2 length of data run | 8795 | * 4 2 length of data run |
8518 | * 6 length data | 8796 | * 6 length data |
8519 | */ | 8797 | */ |
8520 | unsigned int addr; | 8798 | unsigned int addr; |
8521 | unsigned short len; | 8799 | unsigned short len; |
@@ -8524,12 +8802,12 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, | |||
8524 | unsigned int firmware_data_left = fw->fw.size; | 8802 | unsigned int firmware_data_left = fw->fw.size; |
8525 | 8803 | ||
8526 | while (firmware_data_left > 0) { | 8804 | while (firmware_data_left > 0) { |
8527 | addr = *(u32 *)(firmware_data); | 8805 | addr = *(u32 *) (firmware_data); |
8528 | firmware_data += 4; | 8806 | firmware_data += 4; |
8529 | firmware_data_left -= 4; | 8807 | firmware_data_left -= 4; |
8530 | 8808 | ||
8531 | len = *(u16 *)(firmware_data); | 8809 | len = *(u16 *) (firmware_data); |
8532 | firmware_data += 2; | 8810 | firmware_data += 2; |
8533 | firmware_data_left -= 2; | 8811 | firmware_data_left -= 2; |
8534 | 8812 | ||
8535 | if (len > 32) { | 8813 | if (len > 32) { |
@@ -8540,7 +8818,7 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, | |||
8540 | } | 8818 | } |
8541 | 8819 | ||
8542 | write_nic_memory(priv->net_dev, addr, len, firmware_data); | 8820 | write_nic_memory(priv->net_dev, addr, len, firmware_data); |
8543 | firmware_data += len; | 8821 | firmware_data += len; |
8544 | firmware_data_left -= len; | 8822 | firmware_data_left -= len; |
8545 | } | 8823 | } |
8546 | 8824 | ||
@@ -8654,21 +8932,19 @@ static int ipw2100_ucode_download(struct ipw2100_priv *priv, | |||
8654 | for (i = 0; i < 30; i++) { | 8932 | for (i = 0; i < 30; i++) { |
8655 | /* Read alive response structure */ | 8933 | /* Read alive response structure */ |
8656 | for (j = 0; | 8934 | for (j = 0; |
8657 | j < (sizeof(struct symbol_alive_response) >> 1); | 8935 | j < (sizeof(struct symbol_alive_response) >> 1); j++) |
8658 | j++) | 8936 | read_nic_word(dev, 0x210004, ((u16 *) & response) + j); |
8659 | read_nic_word(dev, 0x210004, | ||
8660 | ((u16 *)&response) + j); | ||
8661 | 8937 | ||
8662 | if ((response.cmd_id == 1) && | 8938 | if ((response.cmd_id == 1) && (response.ucode_valid == 0x1)) |
8663 | (response.ucode_valid == 0x1)) | ||
8664 | break; | 8939 | break; |
8665 | udelay(10); | 8940 | udelay(10); |
8666 | } | 8941 | } |
8667 | 8942 | ||
8668 | if (i == 30) { | 8943 | if (i == 30) { |
8669 | printk(KERN_ERR DRV_NAME ": %s: No response from Symbol - hw not alive\n", | 8944 | printk(KERN_ERR DRV_NAME |
8945 | ": %s: No response from Symbol - hw not alive\n", | ||
8670 | dev->name); | 8946 | dev->name); |
8671 | printk_buf(IPW_DL_ERROR, (u8*)&response, sizeof(response)); | 8947 | printk_buf(IPW_DL_ERROR, (u8 *) & response, sizeof(response)); |
8672 | return -EIO; | 8948 | return -EIO; |
8673 | } | 8949 | } |
8674 | 8950 | ||
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index 1f23650c077f..140fdf2a0a09 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it | 5 | This program is free software; you can redistribute it and/or modify it |
6 | under the terms of version 2 of the GNU General Public License as | 6 | under the terms of version 2 of the GNU General Public License as |
@@ -92,7 +92,6 @@ struct ipw2100_rx_packet; | |||
92 | #define IPW_DL_IOCTL (1<<14) | 92 | #define IPW_DL_IOCTL (1<<14) |
93 | #define IPW_DL_RF_KILL (1<<17) | 93 | #define IPW_DL_RF_KILL (1<<17) |
94 | 94 | ||
95 | |||
96 | #define IPW_DL_MANAGE (1<<15) | 95 | #define IPW_DL_MANAGE (1<<15) |
97 | #define IPW_DL_FW (1<<16) | 96 | #define IPW_DL_FW (1<<16) |
98 | 97 | ||
@@ -155,7 +154,9 @@ extern const char *band_str[]; | |||
155 | 154 | ||
156 | struct bd_status { | 155 | struct bd_status { |
157 | union { | 156 | union { |
158 | struct { u8 nlf:1, txType:2, intEnabled:1, reserved:4;} fields; | 157 | struct { |
158 | u8 nlf:1, txType:2, intEnabled:1, reserved:4; | ||
159 | } fields; | ||
159 | u8 field; | 160 | u8 field; |
160 | } info; | 161 | } info; |
161 | } __attribute__ ((packed)); | 162 | } __attribute__ ((packed)); |
@@ -164,7 +165,7 @@ struct ipw2100_bd { | |||
164 | u32 host_addr; | 165 | u32 host_addr; |
165 | u32 buf_length; | 166 | u32 buf_length; |
166 | struct bd_status status; | 167 | struct bd_status status; |
167 | /* number of fragments for frame (should be set only for | 168 | /* number of fragments for frame (should be set only for |
168 | * 1st TBD) */ | 169 | * 1st TBD) */ |
169 | u8 num_fragments; | 170 | u8 num_fragments; |
170 | u8 reserved[6]; | 171 | u8 reserved[6]; |
@@ -292,10 +293,10 @@ struct ipw2100_cmd_header { | |||
292 | struct ipw2100_data_header { | 293 | struct ipw2100_data_header { |
293 | u32 host_command_reg; | 294 | u32 host_command_reg; |
294 | u32 host_command_reg1; | 295 | u32 host_command_reg1; |
295 | u8 encrypted; // BOOLEAN in win! TRUE if frame is enc by driver | 296 | u8 encrypted; // BOOLEAN in win! TRUE if frame is enc by driver |
296 | u8 needs_encryption; // BOOLEAN in win! TRUE if frma need to be enc in NIC | 297 | u8 needs_encryption; // BOOLEAN in win! TRUE if frma need to be enc in NIC |
297 | u8 wep_index; // 0 no key, 1-4 key index, 0xff immediate key | 298 | u8 wep_index; // 0 no key, 1-4 key index, 0xff immediate key |
298 | u8 key_size; // 0 no imm key, 0x5 64bit encr, 0xd 128bit encr, 0x10 128bit encr and 128bit IV | 299 | u8 key_size; // 0 no imm key, 0x5 64bit encr, 0xd 128bit encr, 0x10 128bit encr and 128bit IV |
299 | u8 key[16]; | 300 | u8 key[16]; |
300 | u8 reserved[10]; // f/w reserved | 301 | u8 reserved[10]; // f/w reserved |
301 | u8 src_addr[ETH_ALEN]; | 302 | u8 src_addr[ETH_ALEN]; |
@@ -305,14 +306,13 @@ struct ipw2100_data_header { | |||
305 | 306 | ||
306 | /* Host command data structure */ | 307 | /* Host command data structure */ |
307 | struct host_command { | 308 | struct host_command { |
308 | u32 host_command; // COMMAND ID | 309 | u32 host_command; // COMMAND ID |
309 | u32 host_command1; // COMMAND ID | 310 | u32 host_command1; // COMMAND ID |
310 | u32 host_command_sequence; // UNIQUE COMMAND NUMBER (ID) | 311 | u32 host_command_sequence; // UNIQUE COMMAND NUMBER (ID) |
311 | u32 host_command_length; // LENGTH | 312 | u32 host_command_length; // LENGTH |
312 | u32 host_command_parameters[HOST_COMMAND_PARAMS_REG_LEN]; // COMMAND PARAMETERS | 313 | u32 host_command_parameters[HOST_COMMAND_PARAMS_REG_LEN]; // COMMAND PARAMETERS |
313 | } __attribute__ ((packed)); | 314 | } __attribute__ ((packed)); |
314 | 315 | ||
315 | |||
316 | typedef enum { | 316 | typedef enum { |
317 | POWER_ON_RESET, | 317 | POWER_ON_RESET, |
318 | EXIT_POWER_DOWN_RESET, | 318 | EXIT_POWER_DOWN_RESET, |
@@ -327,17 +327,16 @@ enum { | |||
327 | RX | 327 | RX |
328 | }; | 328 | }; |
329 | 329 | ||
330 | |||
331 | struct ipw2100_tx_packet { | 330 | struct ipw2100_tx_packet { |
332 | int type; | 331 | int type; |
333 | int index; | 332 | int index; |
334 | union { | 333 | union { |
335 | struct { /* COMMAND */ | 334 | struct { /* COMMAND */ |
336 | struct ipw2100_cmd_header* cmd; | 335 | struct ipw2100_cmd_header *cmd; |
337 | dma_addr_t cmd_phys; | 336 | dma_addr_t cmd_phys; |
338 | } c_struct; | 337 | } c_struct; |
339 | struct { /* DATA */ | 338 | struct { /* DATA */ |
340 | struct ipw2100_data_header* data; | 339 | struct ipw2100_data_header *data; |
341 | dma_addr_t data_phys; | 340 | dma_addr_t data_phys; |
342 | struct ieee80211_txb *txb; | 341 | struct ieee80211_txb *txb; |
343 | } d_struct; | 342 | } d_struct; |
@@ -347,7 +346,6 @@ struct ipw2100_tx_packet { | |||
347 | struct list_head list; | 346 | struct list_head list; |
348 | }; | 347 | }; |
349 | 348 | ||
350 | |||
351 | struct ipw2100_rx_packet { | 349 | struct ipw2100_rx_packet { |
352 | struct ipw2100_rx *rxp; | 350 | struct ipw2100_rx *rxp; |
353 | dma_addr_t dma_addr; | 351 | dma_addr_t dma_addr; |
@@ -431,13 +429,13 @@ enum { | |||
431 | }; | 429 | }; |
432 | 430 | ||
433 | #define STATUS_POWERED (1<<0) | 431 | #define STATUS_POWERED (1<<0) |
434 | #define STATUS_CMD_ACTIVE (1<<1) /**< host command in progress */ | 432 | #define STATUS_CMD_ACTIVE (1<<1) /**< host command in progress */ |
435 | #define STATUS_RUNNING (1<<2) /* Card initialized, but not enabled */ | 433 | #define STATUS_RUNNING (1<<2) /* Card initialized, but not enabled */ |
436 | #define STATUS_ENABLED (1<<3) /* Card enabled -- can scan,Tx,Rx */ | 434 | #define STATUS_ENABLED (1<<3) /* Card enabled -- can scan,Tx,Rx */ |
437 | #define STATUS_STOPPING (1<<4) /* Card is in shutdown phase */ | 435 | #define STATUS_STOPPING (1<<4) /* Card is in shutdown phase */ |
438 | #define STATUS_INITIALIZED (1<<5) /* Card is ready for external calls */ | 436 | #define STATUS_INITIALIZED (1<<5) /* Card is ready for external calls */ |
439 | #define STATUS_ASSOCIATING (1<<9) /* Associated, but no BSSID yet */ | 437 | #define STATUS_ASSOCIATING (1<<9) /* Associated, but no BSSID yet */ |
440 | #define STATUS_ASSOCIATED (1<<10) /* Associated and BSSID valid */ | 438 | #define STATUS_ASSOCIATED (1<<10) /* Associated and BSSID valid */ |
441 | #define STATUS_INT_ENABLED (1<<11) | 439 | #define STATUS_INT_ENABLED (1<<11) |
442 | #define STATUS_RF_KILL_HW (1<<12) | 440 | #define STATUS_RF_KILL_HW (1<<12) |
443 | #define STATUS_RF_KILL_SW (1<<13) | 441 | #define STATUS_RF_KILL_SW (1<<13) |
@@ -450,9 +448,7 @@ enum { | |||
450 | #define STATUS_SCAN_COMPLETE (1<<26) | 448 | #define STATUS_SCAN_COMPLETE (1<<26) |
451 | #define STATUS_WX_EVENT_PENDING (1<<27) | 449 | #define STATUS_WX_EVENT_PENDING (1<<27) |
452 | #define STATUS_RESET_PENDING (1<<29) | 450 | #define STATUS_RESET_PENDING (1<<29) |
453 | #define STATUS_SECURITY_UPDATED (1<<30) /* Security sync needed */ | 451 | #define STATUS_SECURITY_UPDATED (1<<30) /* Security sync needed */ |
454 | |||
455 | |||
456 | 452 | ||
457 | /* Internal NIC states */ | 453 | /* Internal NIC states */ |
458 | #define IPW_STATE_INITIALIZED (1<<0) | 454 | #define IPW_STATE_INITIALIZED (1<<0) |
@@ -468,11 +464,9 @@ enum { | |||
468 | #define IPW_STATE_POWER_DOWN (1<<10) | 464 | #define IPW_STATE_POWER_DOWN (1<<10) |
469 | #define IPW_STATE_SCANNING (1<<11) | 465 | #define IPW_STATE_SCANNING (1<<11) |
470 | 466 | ||
471 | 467 | #define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ | |
472 | 468 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ | |
473 | #define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ | 469 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ |
474 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ | ||
475 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ | ||
476 | #define CFG_CUSTOM_MAC (1<<3) | 470 | #define CFG_CUSTOM_MAC (1<<3) |
477 | #define CFG_LONG_PREAMBLE (1<<4) | 471 | #define CFG_LONG_PREAMBLE (1<<4) |
478 | #define CFG_ASSOCIATE (1<<6) | 472 | #define CFG_ASSOCIATE (1<<6) |
@@ -480,14 +474,17 @@ enum { | |||
480 | #define CFG_ADHOC_CREATE (1<<8) | 474 | #define CFG_ADHOC_CREATE (1<<8) |
481 | #define CFG_C3_DISABLED (1<<9) | 475 | #define CFG_C3_DISABLED (1<<9) |
482 | #define CFG_PASSIVE_SCAN (1<<10) | 476 | #define CFG_PASSIVE_SCAN (1<<10) |
477 | #ifdef CONFIG_IPW2100_MONITOR | ||
478 | #define CFG_CRC_CHECK (1<<11) | ||
479 | #endif | ||
483 | 480 | ||
484 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ | 481 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ |
485 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ | 482 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ |
486 | 483 | ||
487 | struct ipw2100_priv { | 484 | struct ipw2100_priv { |
488 | 485 | ||
489 | int stop_hang_check; /* Set 1 when shutting down to kill hang_check */ | 486 | int stop_hang_check; /* Set 1 when shutting down to kill hang_check */ |
490 | int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */ | 487 | int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */ |
491 | 488 | ||
492 | struct ieee80211_device *ieee; | 489 | struct ieee80211_device *ieee; |
493 | unsigned long status; | 490 | unsigned long status; |
@@ -518,19 +515,16 @@ struct ipw2100_priv { | |||
518 | unsigned long hw_features; | 515 | unsigned long hw_features; |
519 | int hangs; | 516 | int hangs; |
520 | u32 last_rtc; | 517 | u32 last_rtc; |
521 | int dump_raw; /* 1 to dump raw bytes in /sys/.../memory */ | 518 | int dump_raw; /* 1 to dump raw bytes in /sys/.../memory */ |
522 | u8* snapshot[0x30]; | 519 | u8 *snapshot[0x30]; |
523 | 520 | ||
524 | u8 mandatory_bssid_mac[ETH_ALEN]; | 521 | u8 mandatory_bssid_mac[ETH_ALEN]; |
525 | u8 mac_addr[ETH_ALEN]; | 522 | u8 mac_addr[ETH_ALEN]; |
526 | 523 | ||
527 | int power_mode; | 524 | int power_mode; |
528 | 525 | ||
529 | /* WEP data */ | ||
530 | struct ieee80211_security sec; | ||
531 | int messages_sent; | 526 | int messages_sent; |
532 | 527 | ||
533 | |||
534 | int short_retry_limit; | 528 | int short_retry_limit; |
535 | int long_retry_limit; | 529 | int long_retry_limit; |
536 | 530 | ||
@@ -598,7 +592,6 @@ struct ipw2100_priv { | |||
598 | wait_queue_head_t wait_command_queue; | 592 | wait_queue_head_t wait_command_queue; |
599 | }; | 593 | }; |
600 | 594 | ||
601 | |||
602 | /********************************************************* | 595 | /********************************************************* |
603 | * Host Command -> From Driver to FW | 596 | * Host Command -> From Driver to FW |
604 | *********************************************************/ | 597 | *********************************************************/ |
@@ -645,7 +638,6 @@ struct ipw2100_priv { | |||
645 | #define CARD_DISABLE_PHY_OFF 61 | 638 | #define CARD_DISABLE_PHY_OFF 61 |
646 | #define MSDU_TX_RATES 62 | 639 | #define MSDU_TX_RATES 62 |
647 | 640 | ||
648 | |||
649 | /* Rogue AP Detection */ | 641 | /* Rogue AP Detection */ |
650 | #define SET_STATION_STAT_BITS 64 | 642 | #define SET_STATION_STAT_BITS 64 |
651 | #define CLEAR_STATIONS_STAT_BITS 65 | 643 | #define CLEAR_STATIONS_STAT_BITS 65 |
@@ -654,8 +646,6 @@ struct ipw2100_priv { | |||
654 | #define DISASSOCIATION_BSSID 68 | 646 | #define DISASSOCIATION_BSSID 68 |
655 | #define SET_WPA_IE 69 | 647 | #define SET_WPA_IE 69 |
656 | 648 | ||
657 | |||
658 | |||
659 | /* system configuration bit mask: */ | 649 | /* system configuration bit mask: */ |
660 | #define IPW_CFG_MONITOR 0x00004 | 650 | #define IPW_CFG_MONITOR 0x00004 |
661 | #define IPW_CFG_PREAMBLE_AUTO 0x00010 | 651 | #define IPW_CFG_PREAMBLE_AUTO 0x00010 |
@@ -703,7 +693,7 @@ struct ipw2100_priv { | |||
703 | #define IPW2100_INTA_TX_TRANSFER (0x00000001) // Bit 0 (LSB) | 693 | #define IPW2100_INTA_TX_TRANSFER (0x00000001) // Bit 0 (LSB) |
704 | #define IPW2100_INTA_RX_TRANSFER (0x00000002) // Bit 1 | 694 | #define IPW2100_INTA_RX_TRANSFER (0x00000002) // Bit 1 |
705 | #define IPW2100_INTA_TX_COMPLETE (0x00000004) // Bit 2 | 695 | #define IPW2100_INTA_TX_COMPLETE (0x00000004) // Bit 2 |
706 | #define IPW2100_INTA_EVENT_INTERRUPT (0x00000008) // Bit 3 | 696 | #define IPW2100_INTA_EVENT_INTERRUPT (0x00000008) // Bit 3 |
707 | #define IPW2100_INTA_STATUS_CHANGE (0x00000010) // Bit 4 | 697 | #define IPW2100_INTA_STATUS_CHANGE (0x00000010) // Bit 4 |
708 | #define IPW2100_INTA_BEACON_PERIOD_EXPIRED (0x00000020) // Bit 5 | 698 | #define IPW2100_INTA_BEACON_PERIOD_EXPIRED (0x00000020) // Bit 5 |
709 | #define IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE (0x00010000) // Bit 16 | 699 | #define IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE (0x00010000) // Bit 16 |
@@ -783,9 +773,6 @@ struct ipw2100_priv { | |||
783 | #define IPW_CARD_DISABLE_PHY_OFF_COMPLETE_WAIT 100 // 100 milli | 773 | #define IPW_CARD_DISABLE_PHY_OFF_COMPLETE_WAIT 100 // 100 milli |
784 | #define IPW_PREPARE_POWER_DOWN_COMPLETE_WAIT 100 // 100 milli | 774 | #define IPW_PREPARE_POWER_DOWN_COMPLETE_WAIT 100 // 100 milli |
785 | 775 | ||
786 | |||
787 | |||
788 | |||
789 | #define IPW_HEADER_802_11_SIZE sizeof(struct ieee80211_hdr_3addr) | 776 | #define IPW_HEADER_802_11_SIZE sizeof(struct ieee80211_hdr_3addr) |
790 | #define IPW_MAX_80211_PAYLOAD_SIZE 2304U | 777 | #define IPW_MAX_80211_PAYLOAD_SIZE 2304U |
791 | #define IPW_MAX_802_11_PAYLOAD_LENGTH 2312 | 778 | #define IPW_MAX_802_11_PAYLOAD_LENGTH 2312 |
@@ -842,8 +829,8 @@ struct ipw2100_rx { | |||
842 | #define IPW_TX_POWER_MIN_DBM (-12) | 829 | #define IPW_TX_POWER_MIN_DBM (-12) |
843 | #define IPW_TX_POWER_MAX_DBM 16 | 830 | #define IPW_TX_POWER_MAX_DBM 16 |
844 | 831 | ||
845 | #define FW_SCAN_DONOT_ASSOCIATE 0x0001 // Dont Attempt to Associate after Scan | 832 | #define FW_SCAN_DONOT_ASSOCIATE 0x0001 // Dont Attempt to Associate after Scan |
846 | #define FW_SCAN_PASSIVE 0x0008 // Force PASSSIVE Scan | 833 | #define FW_SCAN_PASSIVE 0x0008 // Force PASSSIVE Scan |
847 | 834 | ||
848 | #define REG_MIN_CHANNEL 0 | 835 | #define REG_MIN_CHANNEL 0 |
849 | #define REG_MAX_CHANNEL 14 | 836 | #define REG_MAX_CHANNEL 14 |
@@ -855,7 +842,6 @@ struct ipw2100_rx { | |||
855 | #define DIVERSITY_ANTENNA_A 1 // Use antenna A | 842 | #define DIVERSITY_ANTENNA_A 1 // Use antenna A |
856 | #define DIVERSITY_ANTENNA_B 2 // Use antenna B | 843 | #define DIVERSITY_ANTENNA_B 2 // Use antenna B |
857 | 844 | ||
858 | |||
859 | #define HOST_COMMAND_WAIT 0 | 845 | #define HOST_COMMAND_WAIT 0 |
860 | #define HOST_COMMAND_NO_WAIT 1 | 846 | #define HOST_COMMAND_NO_WAIT 1 |
861 | 847 | ||
@@ -872,10 +858,9 @@ struct ipw2100_rx { | |||
872 | #define TYPE_ASSOCIATION_REQUEST 0x0013 | 858 | #define TYPE_ASSOCIATION_REQUEST 0x0013 |
873 | #define TYPE_REASSOCIATION_REQUEST 0x0014 | 859 | #define TYPE_REASSOCIATION_REQUEST 0x0014 |
874 | 860 | ||
875 | 861 | #define HW_FEATURE_RFKILL 0x0001 | |
876 | #define HW_FEATURE_RFKILL (0x0001) | 862 | #define RF_KILLSWITCH_OFF 1 |
877 | #define RF_KILLSWITCH_OFF (1) | 863 | #define RF_KILLSWITCH_ON 0 |
878 | #define RF_KILLSWITCH_ON (0) | ||
879 | 864 | ||
880 | #define IPW_COMMAND_POOL_SIZE 40 | 865 | #define IPW_COMMAND_POOL_SIZE 40 |
881 | 866 | ||
@@ -894,7 +879,7 @@ struct ipw2100_rx { | |||
894 | // Fixed size data: Ordinal Table 1 | 879 | // Fixed size data: Ordinal Table 1 |
895 | typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | 880 | typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW |
896 | // Transmit statistics | 881 | // Transmit statistics |
897 | IPW_ORD_STAT_TX_HOST_REQUESTS = 1,// # of requested Host Tx's (MSDU) | 882 | IPW_ORD_STAT_TX_HOST_REQUESTS = 1, // # of requested Host Tx's (MSDU) |
898 | IPW_ORD_STAT_TX_HOST_COMPLETE, // # of successful Host Tx's (MSDU) | 883 | IPW_ORD_STAT_TX_HOST_COMPLETE, // # of successful Host Tx's (MSDU) |
899 | IPW_ORD_STAT_TX_DIR_DATA, // # of successful Directed Tx's (MSDU) | 884 | IPW_ORD_STAT_TX_DIR_DATA, // # of successful Directed Tx's (MSDU) |
900 | 885 | ||
@@ -904,42 +889,42 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | |||
904 | IPW_ORD_STAT_TX_DIR_DATA11, // # of successful Directed Tx's (MSDU) @ 11MB | 889 | IPW_ORD_STAT_TX_DIR_DATA11, // # of successful Directed Tx's (MSDU) @ 11MB |
905 | IPW_ORD_STAT_TX_DIR_DATA22, // # of successful Directed Tx's (MSDU) @ 22MB | 890 | IPW_ORD_STAT_TX_DIR_DATA22, // # of successful Directed Tx's (MSDU) @ 22MB |
906 | 891 | ||
907 | IPW_ORD_STAT_TX_NODIR_DATA1 = 13,// # of successful Non_Directed Tx's (MSDU) @ 1MB | 892 | IPW_ORD_STAT_TX_NODIR_DATA1 = 13, // # of successful Non_Directed Tx's (MSDU) @ 1MB |
908 | IPW_ORD_STAT_TX_NODIR_DATA2, // # of successful Non_Directed Tx's (MSDU) @ 2MB | 893 | IPW_ORD_STAT_TX_NODIR_DATA2, // # of successful Non_Directed Tx's (MSDU) @ 2MB |
909 | IPW_ORD_STAT_TX_NODIR_DATA5_5, // # of successful Non_Directed Tx's (MSDU) @ 5.5MB | 894 | IPW_ORD_STAT_TX_NODIR_DATA5_5, // # of successful Non_Directed Tx's (MSDU) @ 5.5MB |
910 | IPW_ORD_STAT_TX_NODIR_DATA11, // # of successful Non_Directed Tx's (MSDU) @ 11MB | 895 | IPW_ORD_STAT_TX_NODIR_DATA11, // # of successful Non_Directed Tx's (MSDU) @ 11MB |
911 | 896 | ||
912 | IPW_ORD_STAT_NULL_DATA = 21, // # of successful NULL data Tx's | 897 | IPW_ORD_STAT_NULL_DATA = 21, // # of successful NULL data Tx's |
913 | IPW_ORD_STAT_TX_RTS, // # of successful Tx RTS | 898 | IPW_ORD_STAT_TX_RTS, // # of successful Tx RTS |
914 | IPW_ORD_STAT_TX_CTS, // # of successful Tx CTS | 899 | IPW_ORD_STAT_TX_CTS, // # of successful Tx CTS |
915 | IPW_ORD_STAT_TX_ACK, // # of successful Tx ACK | 900 | IPW_ORD_STAT_TX_ACK, // # of successful Tx ACK |
916 | IPW_ORD_STAT_TX_ASSN, // # of successful Association Tx's | 901 | IPW_ORD_STAT_TX_ASSN, // # of successful Association Tx's |
917 | IPW_ORD_STAT_TX_ASSN_RESP, // # of successful Association response Tx's | 902 | IPW_ORD_STAT_TX_ASSN_RESP, // # of successful Association response Tx's |
918 | IPW_ORD_STAT_TX_REASSN, // # of successful Reassociation Tx's | 903 | IPW_ORD_STAT_TX_REASSN, // # of successful Reassociation Tx's |
919 | IPW_ORD_STAT_TX_REASSN_RESP, // # of successful Reassociation response Tx's | 904 | IPW_ORD_STAT_TX_REASSN_RESP, // # of successful Reassociation response Tx's |
920 | IPW_ORD_STAT_TX_PROBE, // # of probes successfully transmitted | 905 | IPW_ORD_STAT_TX_PROBE, // # of probes successfully transmitted |
921 | IPW_ORD_STAT_TX_PROBE_RESP, // # of probe responses successfully transmitted | 906 | IPW_ORD_STAT_TX_PROBE_RESP, // # of probe responses successfully transmitted |
922 | IPW_ORD_STAT_TX_BEACON, // # of tx beacon | 907 | IPW_ORD_STAT_TX_BEACON, // # of tx beacon |
923 | IPW_ORD_STAT_TX_ATIM, // # of Tx ATIM | 908 | IPW_ORD_STAT_TX_ATIM, // # of Tx ATIM |
924 | IPW_ORD_STAT_TX_DISASSN, // # of successful Disassociation TX | 909 | IPW_ORD_STAT_TX_DISASSN, // # of successful Disassociation TX |
925 | IPW_ORD_STAT_TX_AUTH, // # of successful Authentication Tx | 910 | IPW_ORD_STAT_TX_AUTH, // # of successful Authentication Tx |
926 | IPW_ORD_STAT_TX_DEAUTH, // # of successful Deauthentication TX | 911 | IPW_ORD_STAT_TX_DEAUTH, // # of successful Deauthentication TX |
927 | 912 | ||
928 | IPW_ORD_STAT_TX_TOTAL_BYTES = 41,// Total successful Tx data bytes | 913 | IPW_ORD_STAT_TX_TOTAL_BYTES = 41, // Total successful Tx data bytes |
929 | IPW_ORD_STAT_TX_RETRIES, // # of Tx retries | 914 | IPW_ORD_STAT_TX_RETRIES, // # of Tx retries |
930 | IPW_ORD_STAT_TX_RETRY1, // # of Tx retries at 1MBPS | 915 | IPW_ORD_STAT_TX_RETRY1, // # of Tx retries at 1MBPS |
931 | IPW_ORD_STAT_TX_RETRY2, // # of Tx retries at 2MBPS | 916 | IPW_ORD_STAT_TX_RETRY2, // # of Tx retries at 2MBPS |
932 | IPW_ORD_STAT_TX_RETRY5_5, // # of Tx retries at 5.5MBPS | 917 | IPW_ORD_STAT_TX_RETRY5_5, // # of Tx retries at 5.5MBPS |
933 | IPW_ORD_STAT_TX_RETRY11, // # of Tx retries at 11MBPS | 918 | IPW_ORD_STAT_TX_RETRY11, // # of Tx retries at 11MBPS |
934 | 919 | ||
935 | IPW_ORD_STAT_TX_FAILURES = 51, // # of Tx Failures | 920 | IPW_ORD_STAT_TX_FAILURES = 51, // # of Tx Failures |
936 | IPW_ORD_STAT_TX_ABORT_AT_HOP, //NS // # of Tx's aborted at hop time | 921 | IPW_ORD_STAT_TX_ABORT_AT_HOP, //NS // # of Tx's aborted at hop time |
937 | IPW_ORD_STAT_TX_MAX_TRIES_IN_HOP,// # of times max tries in a hop failed | 922 | IPW_ORD_STAT_TX_MAX_TRIES_IN_HOP, // # of times max tries in a hop failed |
938 | IPW_ORD_STAT_TX_ABORT_LATE_DMA, //NS // # of times tx aborted due to late dma setup | 923 | IPW_ORD_STAT_TX_ABORT_LATE_DMA, //NS // # of times tx aborted due to late dma setup |
939 | IPW_ORD_STAT_TX_ABORT_STX, //NS // # of times backoff aborted | 924 | IPW_ORD_STAT_TX_ABORT_STX, //NS // # of times backoff aborted |
940 | IPW_ORD_STAT_TX_DISASSN_FAIL, // # of times disassociation failed | 925 | IPW_ORD_STAT_TX_DISASSN_FAIL, // # of times disassociation failed |
941 | IPW_ORD_STAT_TX_ERR_CTS, // # of missed/bad CTS frames | 926 | IPW_ORD_STAT_TX_ERR_CTS, // # of missed/bad CTS frames |
942 | IPW_ORD_STAT_TX_BPDU, //NS // # of spanning tree BPDUs sent | 927 | IPW_ORD_STAT_TX_BPDU, //NS // # of spanning tree BPDUs sent |
943 | IPW_ORD_STAT_TX_ERR_ACK, // # of tx err due to acks | 928 | IPW_ORD_STAT_TX_ERR_ACK, // # of tx err due to acks |
944 | 929 | ||
945 | // Receive statistics | 930 | // Receive statistics |
@@ -951,7 +936,7 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | |||
951 | IPW_ORD_STAT_RX_DIR_DATA11, // # of directed packets at 11MB | 936 | IPW_ORD_STAT_RX_DIR_DATA11, // # of directed packets at 11MB |
952 | IPW_ORD_STAT_RX_DIR_DATA22, // # of directed packets at 22MB | 937 | IPW_ORD_STAT_RX_DIR_DATA22, // # of directed packets at 22MB |
953 | 938 | ||
954 | IPW_ORD_STAT_RX_NODIR_DATA = 71,// # of nondirected packets | 939 | IPW_ORD_STAT_RX_NODIR_DATA = 71, // # of nondirected packets |
955 | IPW_ORD_STAT_RX_NODIR_DATA1, // # of nondirected packets at 1MB | 940 | IPW_ORD_STAT_RX_NODIR_DATA1, // # of nondirected packets at 1MB |
956 | IPW_ORD_STAT_RX_NODIR_DATA2, // # of nondirected packets at 2MB | 941 | IPW_ORD_STAT_RX_NODIR_DATA2, // # of nondirected packets at 2MB |
957 | IPW_ORD_STAT_RX_NODIR_DATA5_5, // # of nondirected packets at 5.5MB | 942 | IPW_ORD_STAT_RX_NODIR_DATA5_5, // # of nondirected packets at 5.5MB |
@@ -976,18 +961,18 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | |||
976 | IPW_ORD_STAT_RX_AUTH, // # of authentication Rx | 961 | IPW_ORD_STAT_RX_AUTH, // # of authentication Rx |
977 | IPW_ORD_STAT_RX_DEAUTH, // # of deauthentication Rx | 962 | IPW_ORD_STAT_RX_DEAUTH, // # of deauthentication Rx |
978 | 963 | ||
979 | IPW_ORD_STAT_RX_TOTAL_BYTES = 101,// Total rx data bytes received | 964 | IPW_ORD_STAT_RX_TOTAL_BYTES = 101, // Total rx data bytes received |
980 | IPW_ORD_STAT_RX_ERR_CRC, // # of packets with Rx CRC error | 965 | IPW_ORD_STAT_RX_ERR_CRC, // # of packets with Rx CRC error |
981 | IPW_ORD_STAT_RX_ERR_CRC1, // # of Rx CRC errors at 1MB | 966 | IPW_ORD_STAT_RX_ERR_CRC1, // # of Rx CRC errors at 1MB |
982 | IPW_ORD_STAT_RX_ERR_CRC2, // # of Rx CRC errors at 2MB | 967 | IPW_ORD_STAT_RX_ERR_CRC2, // # of Rx CRC errors at 2MB |
983 | IPW_ORD_STAT_RX_ERR_CRC5_5, // # of Rx CRC errors at 5.5MB | 968 | IPW_ORD_STAT_RX_ERR_CRC5_5, // # of Rx CRC errors at 5.5MB |
984 | IPW_ORD_STAT_RX_ERR_CRC11, // # of Rx CRC errors at 11MB | 969 | IPW_ORD_STAT_RX_ERR_CRC11, // # of Rx CRC errors at 11MB |
985 | 970 | ||
986 | IPW_ORD_STAT_RX_DUPLICATE1 = 112, // # of duplicate rx packets at 1MB | 971 | IPW_ORD_STAT_RX_DUPLICATE1 = 112, // # of duplicate rx packets at 1MB |
987 | IPW_ORD_STAT_RX_DUPLICATE2, // # of duplicate rx packets at 2MB | 972 | IPW_ORD_STAT_RX_DUPLICATE2, // # of duplicate rx packets at 2MB |
988 | IPW_ORD_STAT_RX_DUPLICATE5_5, // # of duplicate rx packets at 5.5MB | 973 | IPW_ORD_STAT_RX_DUPLICATE5_5, // # of duplicate rx packets at 5.5MB |
989 | IPW_ORD_STAT_RX_DUPLICATE11, // # of duplicate rx packets at 11MB | 974 | IPW_ORD_STAT_RX_DUPLICATE11, // # of duplicate rx packets at 11MB |
990 | IPW_ORD_STAT_RX_DUPLICATE = 119, // # of duplicate rx packets | 975 | IPW_ORD_STAT_RX_DUPLICATE = 119, // # of duplicate rx packets |
991 | 976 | ||
992 | IPW_ORD_PERS_DB_LOCK = 120, // # locking fw permanent db | 977 | IPW_ORD_PERS_DB_LOCK = 120, // # locking fw permanent db |
993 | IPW_ORD_PERS_DB_SIZE, // # size of fw permanent db | 978 | IPW_ORD_PERS_DB_SIZE, // # size of fw permanent db |
@@ -1005,17 +990,17 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | |||
1005 | IPW_ORD_STAT_RX_ICV_ERRORS, // # of ICV errors during decryption | 990 | IPW_ORD_STAT_RX_ICV_ERRORS, // # of ICV errors during decryption |
1006 | 991 | ||
1007 | // PSP Statistics | 992 | // PSP Statistics |
1008 | IPW_ORD_STAT_PSP_SUSPENSION = 137,// # of times adapter suspended | 993 | IPW_ORD_STAT_PSP_SUSPENSION = 137, // # of times adapter suspended |
1009 | IPW_ORD_STAT_PSP_BCN_TIMEOUT, // # of beacon timeout | 994 | IPW_ORD_STAT_PSP_BCN_TIMEOUT, // # of beacon timeout |
1010 | IPW_ORD_STAT_PSP_POLL_TIMEOUT, // # of poll response timeouts | 995 | IPW_ORD_STAT_PSP_POLL_TIMEOUT, // # of poll response timeouts |
1011 | IPW_ORD_STAT_PSP_NONDIR_TIMEOUT,// # of timeouts waiting for last broadcast/muticast pkt | 996 | IPW_ORD_STAT_PSP_NONDIR_TIMEOUT, // # of timeouts waiting for last broadcast/muticast pkt |
1012 | IPW_ORD_STAT_PSP_RX_DTIMS, // # of PSP DTIMs received | 997 | IPW_ORD_STAT_PSP_RX_DTIMS, // # of PSP DTIMs received |
1013 | IPW_ORD_STAT_PSP_RX_TIMS, // # of PSP TIMs received | 998 | IPW_ORD_STAT_PSP_RX_TIMS, // # of PSP TIMs received |
1014 | IPW_ORD_STAT_PSP_STATION_ID, // PSP Station ID | 999 | IPW_ORD_STAT_PSP_STATION_ID, // PSP Station ID |
1015 | 1000 | ||
1016 | // Association and roaming | 1001 | // Association and roaming |
1017 | IPW_ORD_LAST_ASSN_TIME = 147, // RTC time of last association | 1002 | IPW_ORD_LAST_ASSN_TIME = 147, // RTC time of last association |
1018 | IPW_ORD_STAT_PERCENT_MISSED_BCNS,// current calculation of % missed beacons | 1003 | IPW_ORD_STAT_PERCENT_MISSED_BCNS, // current calculation of % missed beacons |
1019 | IPW_ORD_STAT_PERCENT_RETRIES, // current calculation of % missed tx retries | 1004 | IPW_ORD_STAT_PERCENT_RETRIES, // current calculation of % missed tx retries |
1020 | IPW_ORD_ASSOCIATED_AP_PTR, // If associated, this is ptr to the associated | 1005 | IPW_ORD_ASSOCIATED_AP_PTR, // If associated, this is ptr to the associated |
1021 | // AP table entry. set to 0 if not associated | 1006 | // AP table entry. set to 0 if not associated |
@@ -1150,7 +1135,7 @@ struct ipw2100_fw_chunk { | |||
1150 | }; | 1135 | }; |
1151 | 1136 | ||
1152 | struct ipw2100_fw_chunk_set { | 1137 | struct ipw2100_fw_chunk_set { |
1153 | const void *data; | 1138 | const void *data; |
1154 | unsigned long size; | 1139 | unsigned long size; |
1155 | }; | 1140 | }; |
1156 | 1141 | ||
@@ -1163,4 +1148,4 @@ struct ipw2100_fw { | |||
1163 | 1148 | ||
1164 | #define MAX_FW_VERSION_LEN 14 | 1149 | #define MAX_FW_VERSION_LEN 14 |
1165 | 1150 | ||
1166 | #endif /* _IPW2100_H */ | 1151 | #endif /* _IPW2100_H */ |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 589aef8ba4e6..b0d195d1721a 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. |
4 | 4 | ||
5 | 802.11 status code portion of this file from ethereal-0.10.6: | 5 | 802.11 status code portion of this file from ethereal-0.10.6: |
6 | Copyright 2000, Axis Communications AB | 6 | Copyright 2000, Axis Communications AB |
@@ -33,29 +33,101 @@ | |||
33 | #include "ipw2200.h" | 33 | #include "ipw2200.h" |
34 | #include <linux/version.h> | 34 | #include <linux/version.h> |
35 | 35 | ||
36 | #define IPW2200_VERSION "1.0.0" | 36 | #define IPW2200_VERSION "git-1.0.8" |
37 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" | 37 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" |
38 | #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" | 38 | #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" |
39 | #define DRV_VERSION IPW2200_VERSION | 39 | #define DRV_VERSION IPW2200_VERSION |
40 | 40 | ||
41 | #define ETH_P_80211_STATS (ETH_P_80211_RAW + 1) | ||
42 | |||
41 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | 43 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
42 | MODULE_VERSION(DRV_VERSION); | 44 | MODULE_VERSION(DRV_VERSION); |
43 | MODULE_AUTHOR(DRV_COPYRIGHT); | 45 | MODULE_AUTHOR(DRV_COPYRIGHT); |
44 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
45 | 47 | ||
48 | static int cmdlog = 0; | ||
46 | static int debug = 0; | 49 | static int debug = 0; |
47 | static int channel = 0; | 50 | static int channel = 0; |
48 | static char *ifname; | ||
49 | static int mode = 0; | 51 | static int mode = 0; |
50 | 52 | ||
51 | static u32 ipw_debug_level; | 53 | static u32 ipw_debug_level; |
52 | static int associate = 1; | 54 | static int associate = 1; |
53 | static int auto_create = 1; | 55 | static int auto_create = 1; |
56 | static int led = 0; | ||
54 | static int disable = 0; | 57 | static int disable = 0; |
58 | static int hwcrypto = 1; | ||
55 | static const char ipw_modes[] = { | 59 | static const char ipw_modes[] = { |
56 | 'a', 'b', 'g', '?' | 60 | 'a', 'b', 'g', '?' |
57 | }; | 61 | }; |
58 | 62 | ||
63 | #ifdef CONFIG_IPW_QOS | ||
64 | static int qos_enable = 0; | ||
65 | static int qos_burst_enable = 0; | ||
66 | static int qos_no_ack_mask = 0; | ||
67 | static int burst_duration_CCK = 0; | ||
68 | static int burst_duration_OFDM = 0; | ||
69 | |||
70 | static struct ieee80211_qos_parameters def_qos_parameters_OFDM = { | ||
71 | {QOS_TX0_CW_MIN_OFDM, QOS_TX1_CW_MIN_OFDM, QOS_TX2_CW_MIN_OFDM, | ||
72 | QOS_TX3_CW_MIN_OFDM}, | ||
73 | {QOS_TX0_CW_MAX_OFDM, QOS_TX1_CW_MAX_OFDM, QOS_TX2_CW_MAX_OFDM, | ||
74 | QOS_TX3_CW_MAX_OFDM}, | ||
75 | {QOS_TX0_AIFS, QOS_TX1_AIFS, QOS_TX2_AIFS, QOS_TX3_AIFS}, | ||
76 | {QOS_TX0_ACM, QOS_TX1_ACM, QOS_TX2_ACM, QOS_TX3_ACM}, | ||
77 | {QOS_TX0_TXOP_LIMIT_OFDM, QOS_TX1_TXOP_LIMIT_OFDM, | ||
78 | QOS_TX2_TXOP_LIMIT_OFDM, QOS_TX3_TXOP_LIMIT_OFDM} | ||
79 | }; | ||
80 | |||
81 | static struct ieee80211_qos_parameters def_qos_parameters_CCK = { | ||
82 | {QOS_TX0_CW_MIN_CCK, QOS_TX1_CW_MIN_CCK, QOS_TX2_CW_MIN_CCK, | ||
83 | QOS_TX3_CW_MIN_CCK}, | ||
84 | {QOS_TX0_CW_MAX_CCK, QOS_TX1_CW_MAX_CCK, QOS_TX2_CW_MAX_CCK, | ||
85 | QOS_TX3_CW_MAX_CCK}, | ||
86 | {QOS_TX0_AIFS, QOS_TX1_AIFS, QOS_TX2_AIFS, QOS_TX3_AIFS}, | ||
87 | {QOS_TX0_ACM, QOS_TX1_ACM, QOS_TX2_ACM, QOS_TX3_ACM}, | ||
88 | {QOS_TX0_TXOP_LIMIT_CCK, QOS_TX1_TXOP_LIMIT_CCK, QOS_TX2_TXOP_LIMIT_CCK, | ||
89 | QOS_TX3_TXOP_LIMIT_CCK} | ||
90 | }; | ||
91 | |||
92 | static struct ieee80211_qos_parameters def_parameters_OFDM = { | ||
93 | {DEF_TX0_CW_MIN_OFDM, DEF_TX1_CW_MIN_OFDM, DEF_TX2_CW_MIN_OFDM, | ||
94 | DEF_TX3_CW_MIN_OFDM}, | ||
95 | {DEF_TX0_CW_MAX_OFDM, DEF_TX1_CW_MAX_OFDM, DEF_TX2_CW_MAX_OFDM, | ||
96 | DEF_TX3_CW_MAX_OFDM}, | ||
97 | {DEF_TX0_AIFS, DEF_TX1_AIFS, DEF_TX2_AIFS, DEF_TX3_AIFS}, | ||
98 | {DEF_TX0_ACM, DEF_TX1_ACM, DEF_TX2_ACM, DEF_TX3_ACM}, | ||
99 | {DEF_TX0_TXOP_LIMIT_OFDM, DEF_TX1_TXOP_LIMIT_OFDM, | ||
100 | DEF_TX2_TXOP_LIMIT_OFDM, DEF_TX3_TXOP_LIMIT_OFDM} | ||
101 | }; | ||
102 | |||
103 | static struct ieee80211_qos_parameters def_parameters_CCK = { | ||
104 | {DEF_TX0_CW_MIN_CCK, DEF_TX1_CW_MIN_CCK, DEF_TX2_CW_MIN_CCK, | ||
105 | DEF_TX3_CW_MIN_CCK}, | ||
106 | {DEF_TX0_CW_MAX_CCK, DEF_TX1_CW_MAX_CCK, DEF_TX2_CW_MAX_CCK, | ||
107 | DEF_TX3_CW_MAX_CCK}, | ||
108 | {DEF_TX0_AIFS, DEF_TX1_AIFS, DEF_TX2_AIFS, DEF_TX3_AIFS}, | ||
109 | {DEF_TX0_ACM, DEF_TX1_ACM, DEF_TX2_ACM, DEF_TX3_ACM}, | ||
110 | {DEF_TX0_TXOP_LIMIT_CCK, DEF_TX1_TXOP_LIMIT_CCK, DEF_TX2_TXOP_LIMIT_CCK, | ||
111 | DEF_TX3_TXOP_LIMIT_CCK} | ||
112 | }; | ||
113 | |||
114 | static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; | ||
115 | |||
116 | static int from_priority_to_tx_queue[] = { | ||
117 | IPW_TX_QUEUE_1, IPW_TX_QUEUE_2, IPW_TX_QUEUE_2, IPW_TX_QUEUE_1, | ||
118 | IPW_TX_QUEUE_3, IPW_TX_QUEUE_3, IPW_TX_QUEUE_4, IPW_TX_QUEUE_4 | ||
119 | }; | ||
120 | |||
121 | static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv); | ||
122 | |||
123 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters | ||
124 | *qos_param); | ||
125 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element | ||
126 | *qos_param); | ||
127 | #endif /* CONFIG_IPW_QOS */ | ||
128 | |||
129 | static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev); | ||
130 | static void ipw_remove_current_network(struct ipw_priv *priv); | ||
59 | static void ipw_rx(struct ipw_priv *priv); | 131 | static void ipw_rx(struct ipw_priv *priv); |
60 | static int ipw_queue_tx_reclaim(struct ipw_priv *priv, | 132 | static int ipw_queue_tx_reclaim(struct ipw_priv *priv, |
61 | struct clx2_tx_queue *txq, int qindex); | 133 | struct clx2_tx_queue *txq, int qindex); |
@@ -69,42 +141,24 @@ static void ipw_tx_queue_free(struct ipw_priv *); | |||
69 | static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *); | 141 | static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *); |
70 | static void ipw_rx_queue_free(struct ipw_priv *, struct ipw_rx_queue *); | 142 | static void ipw_rx_queue_free(struct ipw_priv *, struct ipw_rx_queue *); |
71 | static void ipw_rx_queue_replenish(void *); | 143 | static void ipw_rx_queue_replenish(void *); |
72 | |||
73 | static int ipw_up(struct ipw_priv *); | 144 | static int ipw_up(struct ipw_priv *); |
145 | static void ipw_bg_up(void *); | ||
74 | static void ipw_down(struct ipw_priv *); | 146 | static void ipw_down(struct ipw_priv *); |
147 | static void ipw_bg_down(void *); | ||
75 | static int ipw_config(struct ipw_priv *); | 148 | static int ipw_config(struct ipw_priv *); |
76 | static int init_supported_rates(struct ipw_priv *priv, | 149 | static int init_supported_rates(struct ipw_priv *priv, |
77 | struct ipw_supported_rates *prates); | 150 | struct ipw_supported_rates *prates); |
151 | static void ipw_set_hwcrypto_keys(struct ipw_priv *); | ||
152 | static void ipw_send_wep_keys(struct ipw_priv *, int); | ||
78 | 153 | ||
79 | static u8 band_b_active_channel[MAX_B_CHANNELS] = { | 154 | static int ipw_is_valid_channel(struct ieee80211_device *, u8); |
80 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0 | 155 | static int ipw_channel_to_index(struct ieee80211_device *, u8); |
81 | }; | 156 | static u8 ipw_freq_to_channel(struct ieee80211_device *, u32); |
82 | static u8 band_a_active_channel[MAX_A_CHANNELS] = { | 157 | static int ipw_set_geo(struct ieee80211_device *, const struct ieee80211_geo *); |
83 | 36, 40, 44, 48, 149, 153, 157, 161, 165, 52, 56, 60, 64, 0 | 158 | static const struct ieee80211_geo *ipw_get_geo(struct ieee80211_device *); |
84 | }; | ||
85 | 159 | ||
86 | static int is_valid_channel(int mode_mask, int channel) | 160 | static int snprint_line(char *buf, size_t count, |
87 | { | 161 | const u8 * data, u32 len, u32 ofs) |
88 | int i; | ||
89 | |||
90 | if (!channel) | ||
91 | return 0; | ||
92 | |||
93 | if (mode_mask & IEEE_A) | ||
94 | for (i = 0; i < MAX_A_CHANNELS; i++) | ||
95 | if (band_a_active_channel[i] == channel) | ||
96 | return IEEE_A; | ||
97 | |||
98 | if (mode_mask & (IEEE_B | IEEE_G)) | ||
99 | for (i = 0; i < MAX_B_CHANNELS; i++) | ||
100 | if (band_b_active_channel[i] == channel) | ||
101 | return mode_mask & (IEEE_B | IEEE_G); | ||
102 | |||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | static char *snprint_line(char *buf, size_t count, | ||
107 | const u8 * data, u32 len, u32 ofs) | ||
108 | { | 162 | { |
109 | int out, i, j, l; | 163 | int out, i, j, l; |
110 | char c; | 164 | char c; |
@@ -135,7 +189,7 @@ static char *snprint_line(char *buf, size_t count, | |||
135 | out += snprintf(buf + out, count - out, " "); | 189 | out += snprintf(buf + out, count - out, " "); |
136 | } | 190 | } |
137 | 191 | ||
138 | return buf; | 192 | return out; |
139 | } | 193 | } |
140 | 194 | ||
141 | static void printk_buf(int level, const u8 * data, u32 len) | 195 | static void printk_buf(int level, const u8 * data, u32 len) |
@@ -146,14 +200,33 @@ static void printk_buf(int level, const u8 * data, u32 len) | |||
146 | return; | 200 | return; |
147 | 201 | ||
148 | while (len) { | 202 | while (len) { |
149 | printk(KERN_DEBUG "%s\n", | 203 | snprint_line(line, sizeof(line), &data[ofs], |
150 | snprint_line(line, sizeof(line), &data[ofs], | 204 | min(len, 16U), ofs); |
151 | min(len, 16U), ofs)); | 205 | printk(KERN_DEBUG "%s\n", line); |
152 | ofs += 16; | 206 | ofs += 16; |
153 | len -= min(len, 16U); | 207 | len -= min(len, 16U); |
154 | } | 208 | } |
155 | } | 209 | } |
156 | 210 | ||
211 | static int snprintk_buf(u8 * output, size_t size, const u8 * data, size_t len) | ||
212 | { | ||
213 | size_t out = size; | ||
214 | u32 ofs = 0; | ||
215 | int total = 0; | ||
216 | |||
217 | while (size && len) { | ||
218 | out = snprint_line(output, size, &data[ofs], | ||
219 | min_t(size_t, len, 16U), ofs); | ||
220 | |||
221 | ofs += 16; | ||
222 | output += out; | ||
223 | size -= out; | ||
224 | len -= min_t(size_t, len, 16U); | ||
225 | total += out; | ||
226 | } | ||
227 | return total; | ||
228 | } | ||
229 | |||
157 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); | 230 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); |
158 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) | 231 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) |
159 | 232 | ||
@@ -227,38 +300,42 @@ static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | |||
227 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) | 300 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) |
228 | 301 | ||
229 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); | 302 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); |
230 | #define ipw_read_indirect(a, b, c, d) \ | 303 | static inline void __ipw_read_indirect(const char *f, int l, |
231 | IPW_DEBUG_IO("%s %d: read_inddirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ | 304 | struct ipw_priv *a, u32 b, u8 * c, int d) |
232 | _ipw_read_indirect(a, b, c, d) | 305 | { |
306 | IPW_DEBUG_IO("%s %d: read_indirect(0x%08X) %d bytes\n", f, l, (u32) (b), | ||
307 | d); | ||
308 | _ipw_read_indirect(a, b, c, d); | ||
309 | } | ||
310 | |||
311 | #define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) | ||
233 | 312 | ||
234 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, | 313 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, |
235 | int num); | 314 | int num); |
236 | #define ipw_write_indirect(a, b, c, d) \ | 315 | #define ipw_write_indirect(a, b, c, d) \ |
237 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ | 316 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ |
238 | _ipw_write_indirect(a, b, c, d) | 317 | _ipw_write_indirect(a, b, c, d) |
239 | 318 | ||
240 | /* indirect write s */ | 319 | /* indirect write s */ |
241 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) | 320 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) |
242 | { | 321 | { |
243 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); | 322 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); |
244 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); | 323 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg); |
245 | _ipw_write32(priv, CX2_INDIRECT_DATA, value); | 324 | _ipw_write32(priv, IPW_INDIRECT_DATA, value); |
246 | } | 325 | } |
247 | 326 | ||
248 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) | 327 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) |
249 | { | 328 | { |
250 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 329 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
251 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 330 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); |
252 | _ipw_write8(priv, CX2_INDIRECT_DATA, value); | 331 | _ipw_write8(priv, IPW_INDIRECT_DATA, value); |
253 | IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", | ||
254 | (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA), value); | ||
255 | } | 332 | } |
256 | 333 | ||
257 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) | 334 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) |
258 | { | 335 | { |
259 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 336 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
260 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 337 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); |
261 | _ipw_write16(priv, CX2_INDIRECT_DATA, value); | 338 | _ipw_write16(priv, IPW_INDIRECT_DATA, value); |
262 | } | 339 | } |
263 | 340 | ||
264 | /* indirect read s */ | 341 | /* indirect read s */ |
@@ -266,9 +343,9 @@ static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) | |||
266 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | 343 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) |
267 | { | 344 | { |
268 | u32 word; | 345 | u32 word; |
269 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 346 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); |
270 | IPW_DEBUG_IO(" reg = 0x%8X : \n", reg); | 347 | IPW_DEBUG_IO(" reg = 0x%8X : \n", reg); |
271 | word = _ipw_read32(priv, CX2_INDIRECT_DATA); | 348 | word = _ipw_read32(priv, IPW_INDIRECT_DATA); |
272 | return (word >> ((reg & 0x3) * 8)) & 0xff; | 349 | return (word >> ((reg & 0x3) * 8)) & 0xff; |
273 | } | 350 | } |
274 | 351 | ||
@@ -278,8 +355,8 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | |||
278 | 355 | ||
279 | IPW_DEBUG_IO("%p : reg = 0x%08x\n", priv, reg); | 356 | IPW_DEBUG_IO("%p : reg = 0x%08x\n", priv, reg); |
280 | 357 | ||
281 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); | 358 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg); |
282 | value = _ipw_read32(priv, CX2_INDIRECT_DATA); | 359 | value = _ipw_read32(priv, IPW_INDIRECT_DATA); |
283 | IPW_DEBUG_IO(" reg = 0x%4X : value = 0x%4x \n", reg, value); | 360 | IPW_DEBUG_IO(" reg = 0x%4X : value = 0x%4x \n", reg, value); |
284 | return value; | 361 | return value; |
285 | } | 362 | } |
@@ -288,67 +365,69 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | |||
288 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 365 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
289 | int num) | 366 | int num) |
290 | { | 367 | { |
291 | u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; | 368 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; |
292 | u32 dif_len = addr - aligned_addr; | 369 | u32 dif_len = addr - aligned_addr; |
293 | u32 aligned_len; | ||
294 | u32 i; | 370 | u32 i; |
295 | 371 | ||
296 | IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); | 372 | IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); |
297 | 373 | ||
374 | if (num <= 0) { | ||
375 | return; | ||
376 | } | ||
377 | |||
298 | /* Read the first nibble byte by byte */ | 378 | /* Read the first nibble byte by byte */ |
299 | if (unlikely(dif_len)) { | 379 | if (unlikely(dif_len)) { |
380 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | ||
300 | /* Start reading at aligned_addr + dif_len */ | 381 | /* Start reading at aligned_addr + dif_len */ |
301 | _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); | 382 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--) |
302 | for (i = dif_len; i < 4; i++, buf++) | 383 | *buf++ = _ipw_read8(priv, IPW_INDIRECT_DATA + i); |
303 | *buf = _ipw_read8(priv, CX2_INDIRECT_DATA + i); | ||
304 | num -= dif_len; | ||
305 | aligned_addr += 4; | 384 | aligned_addr += 4; |
306 | } | 385 | } |
307 | 386 | ||
308 | /* Read DWs through autoinc register */ | 387 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
309 | _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); | 388 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
310 | aligned_len = num & CX2_INDIRECT_ADDR_MASK; | 389 | *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); |
311 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | ||
312 | *(u32 *) buf = ipw_read32(priv, CX2_AUTOINC_DATA); | ||
313 | 390 | ||
314 | /* Copy the last nibble */ | 391 | /* Copy the last nibble */ |
315 | dif_len = num - aligned_len; | 392 | if (unlikely(num)) { |
316 | _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); | 393 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
317 | for (i = 0; i < dif_len; i++, buf++) | 394 | for (i = 0; num > 0; i++, num--) |
318 | *buf = ipw_read8(priv, CX2_INDIRECT_DATA + i); | 395 | *buf++ = ipw_read8(priv, IPW_INDIRECT_DATA + i); |
396 | } | ||
319 | } | 397 | } |
320 | 398 | ||
321 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 399 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
322 | int num) | 400 | int num) |
323 | { | 401 | { |
324 | u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; | 402 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; |
325 | u32 dif_len = addr - aligned_addr; | 403 | u32 dif_len = addr - aligned_addr; |
326 | u32 aligned_len; | ||
327 | u32 i; | 404 | u32 i; |
328 | 405 | ||
329 | IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); | 406 | IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); |
330 | 407 | ||
408 | if (num <= 0) { | ||
409 | return; | ||
410 | } | ||
411 | |||
331 | /* Write the first nibble byte by byte */ | 412 | /* Write the first nibble byte by byte */ |
332 | if (unlikely(dif_len)) { | 413 | if (unlikely(dif_len)) { |
333 | /* Start writing at aligned_addr + dif_len */ | 414 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
334 | _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); | 415 | /* Start reading at aligned_addr + dif_len */ |
335 | for (i = dif_len; i < 4; i++, buf++) | 416 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) |
336 | _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); | 417 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); |
337 | num -= dif_len; | ||
338 | aligned_addr += 4; | 418 | aligned_addr += 4; |
339 | } | 419 | } |
340 | 420 | ||
341 | /* Write DWs through autoinc register */ | 421 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
342 | _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); | 422 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
343 | aligned_len = num & CX2_INDIRECT_ADDR_MASK; | 423 | _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); |
344 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | ||
345 | _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32 *) buf); | ||
346 | 424 | ||
347 | /* Copy the last nibble */ | 425 | /* Copy the last nibble */ |
348 | dif_len = num - aligned_len; | 426 | if (unlikely(num)) { |
349 | _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); | 427 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
350 | for (i = 0; i < dif_len; i++, buf++) | 428 | for (i = 0; num > 0; i++, num--, buf++) |
351 | _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); | 429 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); |
430 | } | ||
352 | } | 431 | } |
353 | 432 | ||
354 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, | 433 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, |
@@ -372,7 +451,7 @@ static inline void ipw_enable_interrupts(struct ipw_priv *priv) | |||
372 | if (priv->status & STATUS_INT_ENABLED) | 451 | if (priv->status & STATUS_INT_ENABLED) |
373 | return; | 452 | return; |
374 | priv->status |= STATUS_INT_ENABLED; | 453 | priv->status |= STATUS_INT_ENABLED; |
375 | ipw_write32(priv, CX2_INTA_MASK_R, CX2_INTA_MASK_ALL); | 454 | ipw_write32(priv, IPW_INTA_MASK_R, IPW_INTA_MASK_ALL); |
376 | } | 455 | } |
377 | 456 | ||
378 | static inline void ipw_disable_interrupts(struct ipw_priv *priv) | 457 | static inline void ipw_disable_interrupts(struct ipw_priv *priv) |
@@ -380,9 +459,10 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv) | |||
380 | if (!(priv->status & STATUS_INT_ENABLED)) | 459 | if (!(priv->status & STATUS_INT_ENABLED)) |
381 | return; | 460 | return; |
382 | priv->status &= ~STATUS_INT_ENABLED; | 461 | priv->status &= ~STATUS_INT_ENABLED; |
383 | ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); | 462 | ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); |
384 | } | 463 | } |
385 | 464 | ||
465 | #ifdef CONFIG_IPW_DEBUG | ||
386 | static char *ipw_error_desc(u32 val) | 466 | static char *ipw_error_desc(u32 val) |
387 | { | 467 | { |
388 | switch (val) { | 468 | switch (val) { |
@@ -395,81 +475,65 @@ static char *ipw_error_desc(u32 val) | |||
395 | case IPW_FW_ERROR_MEMORY_OVERFLOW: | 475 | case IPW_FW_ERROR_MEMORY_OVERFLOW: |
396 | return "MEMORY_OVERFLOW"; | 476 | return "MEMORY_OVERFLOW"; |
397 | case IPW_FW_ERROR_BAD_PARAM: | 477 | case IPW_FW_ERROR_BAD_PARAM: |
398 | return "ERROR_BAD_PARAM"; | 478 | return "BAD_PARAM"; |
399 | case IPW_FW_ERROR_BAD_CHECKSUM: | 479 | case IPW_FW_ERROR_BAD_CHECKSUM: |
400 | return "ERROR_BAD_CHECKSUM"; | 480 | return "BAD_CHECKSUM"; |
401 | case IPW_FW_ERROR_NMI_INTERRUPT: | 481 | case IPW_FW_ERROR_NMI_INTERRUPT: |
402 | return "ERROR_NMI_INTERRUPT"; | 482 | return "NMI_INTERRUPT"; |
403 | case IPW_FW_ERROR_BAD_DATABASE: | 483 | case IPW_FW_ERROR_BAD_DATABASE: |
404 | return "ERROR_BAD_DATABASE"; | 484 | return "BAD_DATABASE"; |
405 | case IPW_FW_ERROR_ALLOC_FAIL: | 485 | case IPW_FW_ERROR_ALLOC_FAIL: |
406 | return "ERROR_ALLOC_FAIL"; | 486 | return "ALLOC_FAIL"; |
407 | case IPW_FW_ERROR_DMA_UNDERRUN: | 487 | case IPW_FW_ERROR_DMA_UNDERRUN: |
408 | return "ERROR_DMA_UNDERRUN"; | 488 | return "DMA_UNDERRUN"; |
409 | case IPW_FW_ERROR_DMA_STATUS: | 489 | case IPW_FW_ERROR_DMA_STATUS: |
410 | return "ERROR_DMA_STATUS"; | 490 | return "DMA_STATUS"; |
411 | case IPW_FW_ERROR_DINOSTATUS_ERROR: | 491 | case IPW_FW_ERROR_DINO_ERROR: |
412 | return "ERROR_DINOSTATUS_ERROR"; | 492 | return "DINO_ERROR"; |
413 | case IPW_FW_ERROR_EEPROMSTATUS_ERROR: | 493 | case IPW_FW_ERROR_EEPROM_ERROR: |
414 | return "ERROR_EEPROMSTATUS_ERROR"; | 494 | return "EEPROM_ERROR"; |
415 | case IPW_FW_ERROR_SYSASSERT: | 495 | case IPW_FW_ERROR_SYSASSERT: |
416 | return "ERROR_SYSASSERT"; | 496 | return "SYSASSERT"; |
417 | case IPW_FW_ERROR_FATAL_ERROR: | 497 | case IPW_FW_ERROR_FATAL_ERROR: |
418 | return "ERROR_FATALSTATUS_ERROR"; | 498 | return "FATAL_ERROR"; |
419 | default: | 499 | default: |
420 | return "UNKNOWNSTATUS_ERROR"; | 500 | return "UNKNOWN_ERROR"; |
421 | } | 501 | } |
422 | } | 502 | } |
423 | 503 | ||
424 | static void ipw_dump_nic_error_log(struct ipw_priv *priv) | 504 | static void ipw_dump_error_log(struct ipw_priv *priv, |
505 | struct ipw_fw_error *error) | ||
425 | { | 506 | { |
426 | u32 desc, time, blink1, blink2, ilink1, ilink2, idata, i, count, base; | 507 | u32 i; |
427 | |||
428 | base = ipw_read32(priv, IPWSTATUS_ERROR_LOG); | ||
429 | count = ipw_read_reg32(priv, base); | ||
430 | 508 | ||
431 | if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { | 509 | if (!error) { |
432 | IPW_ERROR("Start IPW Error Log Dump:\n"); | 510 | IPW_ERROR("Error allocating and capturing error log. " |
433 | IPW_ERROR("Status: 0x%08X, Config: %08X\n", | 511 | "Nothing to dump.\n"); |
434 | priv->status, priv->config); | 512 | return; |
435 | } | 513 | } |
436 | 514 | ||
437 | for (i = ERROR_START_OFFSET; | 515 | IPW_ERROR("Start IPW Error Log Dump:\n"); |
438 | i <= count * ERROR_ELEM_SIZE; i += ERROR_ELEM_SIZE) { | 516 | IPW_ERROR("Status: 0x%08X, Config: %08X\n", |
439 | desc = ipw_read_reg32(priv, base + i); | 517 | error->status, error->config); |
440 | time = ipw_read_reg32(priv, base + i + 1 * sizeof(u32)); | ||
441 | blink1 = ipw_read_reg32(priv, base + i + 2 * sizeof(u32)); | ||
442 | blink2 = ipw_read_reg32(priv, base + i + 3 * sizeof(u32)); | ||
443 | ilink1 = ipw_read_reg32(priv, base + i + 4 * sizeof(u32)); | ||
444 | ilink2 = ipw_read_reg32(priv, base + i + 5 * sizeof(u32)); | ||
445 | idata = ipw_read_reg32(priv, base + i + 6 * sizeof(u32)); | ||
446 | 518 | ||
519 | for (i = 0; i < error->elem_len; i++) | ||
447 | IPW_ERROR("%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", | 520 | IPW_ERROR("%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", |
448 | ipw_error_desc(desc), time, blink1, blink2, | 521 | ipw_error_desc(error->elem[i].desc), |
449 | ilink1, ilink2, idata); | 522 | error->elem[i].time, |
450 | } | 523 | error->elem[i].blink1, |
524 | error->elem[i].blink2, | ||
525 | error->elem[i].link1, | ||
526 | error->elem[i].link2, error->elem[i].data); | ||
527 | for (i = 0; i < error->log_len; i++) | ||
528 | IPW_ERROR("%i\t0x%08x\t%i\n", | ||
529 | error->log[i].time, | ||
530 | error->log[i].data, error->log[i].event); | ||
451 | } | 531 | } |
532 | #endif | ||
452 | 533 | ||
453 | static void ipw_dump_nic_event_log(struct ipw_priv *priv) | 534 | static inline int ipw_is_init(struct ipw_priv *priv) |
454 | { | 535 | { |
455 | u32 ev, time, data, i, count, base; | 536 | return (priv->status & STATUS_INIT) ? 1 : 0; |
456 | |||
457 | base = ipw_read32(priv, IPW_EVENT_LOG); | ||
458 | count = ipw_read_reg32(priv, base); | ||
459 | |||
460 | if (EVENT_START_OFFSET <= count * EVENT_ELEM_SIZE) | ||
461 | IPW_ERROR("Start IPW Event Log Dump:\n"); | ||
462 | |||
463 | for (i = EVENT_START_OFFSET; | ||
464 | i <= count * EVENT_ELEM_SIZE; i += EVENT_ELEM_SIZE) { | ||
465 | ev = ipw_read_reg32(priv, base + i); | ||
466 | time = ipw_read_reg32(priv, base + i + 1 * sizeof(u32)); | ||
467 | data = ipw_read_reg32(priv, base + i + 2 * sizeof(u32)); | ||
468 | |||
469 | #ifdef CONFIG_IPW_DEBUG | ||
470 | IPW_ERROR("%i\t0x%08x\t%i\n", time, data, ev); | ||
471 | #endif | ||
472 | } | ||
473 | } | 537 | } |
474 | 538 | ||
475 | static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, u32 * len) | 539 | static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, u32 * len) |
@@ -637,6 +701,340 @@ static void ipw_init_ordinals(struct ipw_priv *priv) | |||
637 | 701 | ||
638 | } | 702 | } |
639 | 703 | ||
704 | u32 ipw_register_toggle(u32 reg) | ||
705 | { | ||
706 | reg &= ~IPW_START_STANDBY; | ||
707 | if (reg & IPW_GATE_ODMA) | ||
708 | reg &= ~IPW_GATE_ODMA; | ||
709 | if (reg & IPW_GATE_IDMA) | ||
710 | reg &= ~IPW_GATE_IDMA; | ||
711 | if (reg & IPW_GATE_ADMA) | ||
712 | reg &= ~IPW_GATE_ADMA; | ||
713 | return reg; | ||
714 | } | ||
715 | |||
716 | /* | ||
717 | * LED behavior: | ||
718 | * - On radio ON, turn on any LEDs that require to be on during start | ||
719 | * - On initialization, start unassociated blink | ||
720 | * - On association, disable unassociated blink | ||
721 | * - On disassociation, start unassociated blink | ||
722 | * - On radio OFF, turn off any LEDs started during radio on | ||
723 | * | ||
724 | */ | ||
725 | #define LD_TIME_LINK_ON 300 | ||
726 | #define LD_TIME_LINK_OFF 2700 | ||
727 | #define LD_TIME_ACT_ON 250 | ||
728 | |||
729 | void ipw_led_link_on(struct ipw_priv *priv) | ||
730 | { | ||
731 | unsigned long flags; | ||
732 | u32 led; | ||
733 | |||
734 | /* If configured to not use LEDs, or nic_type is 1, | ||
735 | * then we don't toggle a LINK led */ | ||
736 | if (priv->config & CFG_NO_LED || priv->nic_type == EEPROM_NIC_TYPE_1) | ||
737 | return; | ||
738 | |||
739 | spin_lock_irqsave(&priv->lock, flags); | ||
740 | |||
741 | if (!(priv->status & STATUS_RF_KILL_MASK) && | ||
742 | !(priv->status & STATUS_LED_LINK_ON)) { | ||
743 | IPW_DEBUG_LED("Link LED On\n"); | ||
744 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
745 | led |= priv->led_association_on; | ||
746 | |||
747 | led = ipw_register_toggle(led); | ||
748 | |||
749 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
750 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
751 | |||
752 | priv->status |= STATUS_LED_LINK_ON; | ||
753 | |||
754 | /* If we aren't associated, schedule turning the LED off */ | ||
755 | if (!(priv->status & STATUS_ASSOCIATED)) | ||
756 | queue_delayed_work(priv->workqueue, | ||
757 | &priv->led_link_off, | ||
758 | LD_TIME_LINK_ON); | ||
759 | } | ||
760 | |||
761 | spin_unlock_irqrestore(&priv->lock, flags); | ||
762 | } | ||
763 | |||
764 | static void ipw_bg_led_link_on(void *data) | ||
765 | { | ||
766 | struct ipw_priv *priv = data; | ||
767 | down(&priv->sem); | ||
768 | ipw_led_link_on(data); | ||
769 | up(&priv->sem); | ||
770 | } | ||
771 | |||
772 | void ipw_led_link_off(struct ipw_priv *priv) | ||
773 | { | ||
774 | unsigned long flags; | ||
775 | u32 led; | ||
776 | |||
777 | /* If configured not to use LEDs, or nic type is 1, | ||
778 | * then we don't goggle the LINK led. */ | ||
779 | if (priv->config & CFG_NO_LED || priv->nic_type == EEPROM_NIC_TYPE_1) | ||
780 | return; | ||
781 | |||
782 | spin_lock_irqsave(&priv->lock, flags); | ||
783 | |||
784 | if (priv->status & STATUS_LED_LINK_ON) { | ||
785 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
786 | led &= priv->led_association_off; | ||
787 | led = ipw_register_toggle(led); | ||
788 | |||
789 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
790 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
791 | |||
792 | IPW_DEBUG_LED("Link LED Off\n"); | ||
793 | |||
794 | priv->status &= ~STATUS_LED_LINK_ON; | ||
795 | |||
796 | /* If we aren't associated and the radio is on, schedule | ||
797 | * turning the LED on (blink while unassociated) */ | ||
798 | if (!(priv->status & STATUS_RF_KILL_MASK) && | ||
799 | !(priv->status & STATUS_ASSOCIATED)) | ||
800 | queue_delayed_work(priv->workqueue, &priv->led_link_on, | ||
801 | LD_TIME_LINK_OFF); | ||
802 | |||
803 | } | ||
804 | |||
805 | spin_unlock_irqrestore(&priv->lock, flags); | ||
806 | } | ||
807 | |||
808 | static void ipw_bg_led_link_off(void *data) | ||
809 | { | ||
810 | struct ipw_priv *priv = data; | ||
811 | down(&priv->sem); | ||
812 | ipw_led_link_off(data); | ||
813 | up(&priv->sem); | ||
814 | } | ||
815 | |||
816 | static inline void __ipw_led_activity_on(struct ipw_priv *priv) | ||
817 | { | ||
818 | u32 led; | ||
819 | |||
820 | if (priv->config & CFG_NO_LED) | ||
821 | return; | ||
822 | |||
823 | if (priv->status & STATUS_RF_KILL_MASK) | ||
824 | return; | ||
825 | |||
826 | if (!(priv->status & STATUS_LED_ACT_ON)) { | ||
827 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
828 | led |= priv->led_activity_on; | ||
829 | |||
830 | led = ipw_register_toggle(led); | ||
831 | |||
832 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
833 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
834 | |||
835 | IPW_DEBUG_LED("Activity LED On\n"); | ||
836 | |||
837 | priv->status |= STATUS_LED_ACT_ON; | ||
838 | |||
839 | cancel_delayed_work(&priv->led_act_off); | ||
840 | queue_delayed_work(priv->workqueue, &priv->led_act_off, | ||
841 | LD_TIME_ACT_ON); | ||
842 | } else { | ||
843 | /* Reschedule LED off for full time period */ | ||
844 | cancel_delayed_work(&priv->led_act_off); | ||
845 | queue_delayed_work(priv->workqueue, &priv->led_act_off, | ||
846 | LD_TIME_ACT_ON); | ||
847 | } | ||
848 | } | ||
849 | |||
850 | void ipw_led_activity_on(struct ipw_priv *priv) | ||
851 | { | ||
852 | unsigned long flags; | ||
853 | spin_lock_irqsave(&priv->lock, flags); | ||
854 | __ipw_led_activity_on(priv); | ||
855 | spin_unlock_irqrestore(&priv->lock, flags); | ||
856 | } | ||
857 | |||
858 | void ipw_led_activity_off(struct ipw_priv *priv) | ||
859 | { | ||
860 | unsigned long flags; | ||
861 | u32 led; | ||
862 | |||
863 | if (priv->config & CFG_NO_LED) | ||
864 | return; | ||
865 | |||
866 | spin_lock_irqsave(&priv->lock, flags); | ||
867 | |||
868 | if (priv->status & STATUS_LED_ACT_ON) { | ||
869 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
870 | led &= priv->led_activity_off; | ||
871 | |||
872 | led = ipw_register_toggle(led); | ||
873 | |||
874 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
875 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
876 | |||
877 | IPW_DEBUG_LED("Activity LED Off\n"); | ||
878 | |||
879 | priv->status &= ~STATUS_LED_ACT_ON; | ||
880 | } | ||
881 | |||
882 | spin_unlock_irqrestore(&priv->lock, flags); | ||
883 | } | ||
884 | |||
885 | static void ipw_bg_led_activity_off(void *data) | ||
886 | { | ||
887 | struct ipw_priv *priv = data; | ||
888 | down(&priv->sem); | ||
889 | ipw_led_activity_off(data); | ||
890 | up(&priv->sem); | ||
891 | } | ||
892 | |||
893 | void ipw_led_band_on(struct ipw_priv *priv) | ||
894 | { | ||
895 | unsigned long flags; | ||
896 | u32 led; | ||
897 | |||
898 | /* Only nic type 1 supports mode LEDs */ | ||
899 | if (priv->config & CFG_NO_LED || | ||
900 | priv->nic_type != EEPROM_NIC_TYPE_1 || !priv->assoc_network) | ||
901 | return; | ||
902 | |||
903 | spin_lock_irqsave(&priv->lock, flags); | ||
904 | |||
905 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
906 | if (priv->assoc_network->mode == IEEE_A) { | ||
907 | led |= priv->led_ofdm_on; | ||
908 | led &= priv->led_association_off; | ||
909 | IPW_DEBUG_LED("Mode LED On: 802.11a\n"); | ||
910 | } else if (priv->assoc_network->mode == IEEE_G) { | ||
911 | led |= priv->led_ofdm_on; | ||
912 | led |= priv->led_association_on; | ||
913 | IPW_DEBUG_LED("Mode LED On: 802.11g\n"); | ||
914 | } else { | ||
915 | led &= priv->led_ofdm_off; | ||
916 | led |= priv->led_association_on; | ||
917 | IPW_DEBUG_LED("Mode LED On: 802.11b\n"); | ||
918 | } | ||
919 | |||
920 | led = ipw_register_toggle(led); | ||
921 | |||
922 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
923 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
924 | |||
925 | spin_unlock_irqrestore(&priv->lock, flags); | ||
926 | } | ||
927 | |||
928 | void ipw_led_band_off(struct ipw_priv *priv) | ||
929 | { | ||
930 | unsigned long flags; | ||
931 | u32 led; | ||
932 | |||
933 | /* Only nic type 1 supports mode LEDs */ | ||
934 | if (priv->config & CFG_NO_LED || priv->nic_type != EEPROM_NIC_TYPE_1) | ||
935 | return; | ||
936 | |||
937 | spin_lock_irqsave(&priv->lock, flags); | ||
938 | |||
939 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
940 | led &= priv->led_ofdm_off; | ||
941 | led &= priv->led_association_off; | ||
942 | |||
943 | led = ipw_register_toggle(led); | ||
944 | |||
945 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
946 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
947 | |||
948 | spin_unlock_irqrestore(&priv->lock, flags); | ||
949 | } | ||
950 | |||
951 | void ipw_led_radio_on(struct ipw_priv *priv) | ||
952 | { | ||
953 | ipw_led_link_on(priv); | ||
954 | } | ||
955 | |||
956 | void ipw_led_radio_off(struct ipw_priv *priv) | ||
957 | { | ||
958 | ipw_led_activity_off(priv); | ||
959 | ipw_led_link_off(priv); | ||
960 | } | ||
961 | |||
962 | void ipw_led_link_up(struct ipw_priv *priv) | ||
963 | { | ||
964 | /* Set the Link Led on for all nic types */ | ||
965 | ipw_led_link_on(priv); | ||
966 | } | ||
967 | |||
968 | void ipw_led_link_down(struct ipw_priv *priv) | ||
969 | { | ||
970 | ipw_led_activity_off(priv); | ||
971 | ipw_led_link_off(priv); | ||
972 | |||
973 | if (priv->status & STATUS_RF_KILL_MASK) | ||
974 | ipw_led_radio_off(priv); | ||
975 | } | ||
976 | |||
977 | void ipw_led_init(struct ipw_priv *priv) | ||
978 | { | ||
979 | priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; | ||
980 | |||
981 | /* Set the default PINs for the link and activity leds */ | ||
982 | priv->led_activity_on = IPW_ACTIVITY_LED; | ||
983 | priv->led_activity_off = ~(IPW_ACTIVITY_LED); | ||
984 | |||
985 | priv->led_association_on = IPW_ASSOCIATED_LED; | ||
986 | priv->led_association_off = ~(IPW_ASSOCIATED_LED); | ||
987 | |||
988 | /* Set the default PINs for the OFDM leds */ | ||
989 | priv->led_ofdm_on = IPW_OFDM_LED; | ||
990 | priv->led_ofdm_off = ~(IPW_OFDM_LED); | ||
991 | |||
992 | switch (priv->nic_type) { | ||
993 | case EEPROM_NIC_TYPE_1: | ||
994 | /* In this NIC type, the LEDs are reversed.... */ | ||
995 | priv->led_activity_on = IPW_ASSOCIATED_LED; | ||
996 | priv->led_activity_off = ~(IPW_ASSOCIATED_LED); | ||
997 | priv->led_association_on = IPW_ACTIVITY_LED; | ||
998 | priv->led_association_off = ~(IPW_ACTIVITY_LED); | ||
999 | |||
1000 | if (!(priv->config & CFG_NO_LED)) | ||
1001 | ipw_led_band_on(priv); | ||
1002 | |||
1003 | /* And we don't blink link LEDs for this nic, so | ||
1004 | * just return here */ | ||
1005 | return; | ||
1006 | |||
1007 | case EEPROM_NIC_TYPE_3: | ||
1008 | case EEPROM_NIC_TYPE_2: | ||
1009 | case EEPROM_NIC_TYPE_4: | ||
1010 | case EEPROM_NIC_TYPE_0: | ||
1011 | break; | ||
1012 | |||
1013 | default: | ||
1014 | IPW_DEBUG_INFO("Unknown NIC type from EEPROM: %d\n", | ||
1015 | priv->nic_type); | ||
1016 | priv->nic_type = EEPROM_NIC_TYPE_0; | ||
1017 | break; | ||
1018 | } | ||
1019 | |||
1020 | if (!(priv->config & CFG_NO_LED)) { | ||
1021 | if (priv->status & STATUS_ASSOCIATED) | ||
1022 | ipw_led_link_on(priv); | ||
1023 | else | ||
1024 | ipw_led_link_off(priv); | ||
1025 | } | ||
1026 | } | ||
1027 | |||
1028 | void ipw_led_shutdown(struct ipw_priv *priv) | ||
1029 | { | ||
1030 | ipw_led_activity_off(priv); | ||
1031 | ipw_led_link_off(priv); | ||
1032 | ipw_led_band_off(priv); | ||
1033 | cancel_delayed_work(&priv->led_link_on); | ||
1034 | cancel_delayed_work(&priv->led_link_off); | ||
1035 | cancel_delayed_work(&priv->led_act_off); | ||
1036 | } | ||
1037 | |||
640 | /* | 1038 | /* |
641 | * The following adds a new attribute to the sysfs representation | 1039 | * The following adds a new attribute to the sysfs representation |
642 | * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) | 1040 | * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) |
@@ -648,8 +1046,9 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf) | |||
648 | { | 1046 | { |
649 | return sprintf(buf, "0x%08X\n", ipw_debug_level); | 1047 | return sprintf(buf, "0x%08X\n", ipw_debug_level); |
650 | } | 1048 | } |
651 | static ssize_t store_debug_level(struct device_driver *d, | 1049 | |
652 | const char *buf, size_t count) | 1050 | static ssize_t store_debug_level(struct device_driver *d, const char *buf, |
1051 | size_t count) | ||
653 | { | 1052 | { |
654 | char *p = (char *)buf; | 1053 | char *p = (char *)buf; |
655 | u32 val; | 1054 | u32 val; |
@@ -673,75 +1072,263 @@ static ssize_t store_debug_level(struct device_driver *d, | |||
673 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, | 1072 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, |
674 | show_debug_level, store_debug_level); | 1073 | show_debug_level, store_debug_level); |
675 | 1074 | ||
676 | static ssize_t show_status(struct device *d, | 1075 | static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) |
677 | struct device_attribute *attr, char *buf) | ||
678 | { | 1076 | { |
679 | struct ipw_priv *p = d->driver_data; | 1077 | return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); |
680 | return sprintf(buf, "0x%08x\n", (int)p->status); | ||
681 | } | 1078 | } |
682 | 1079 | ||
683 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); | 1080 | static void ipw_capture_event_log(struct ipw_priv *priv, |
1081 | u32 log_len, struct ipw_event *log) | ||
1082 | { | ||
1083 | u32 base; | ||
684 | 1084 | ||
685 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | 1085 | if (log_len) { |
686 | char *buf) | 1086 | base = ipw_read32(priv, IPW_EVENT_LOG); |
1087 | ipw_read_indirect(priv, base + sizeof(base) + sizeof(u32), | ||
1088 | (u8 *) log, sizeof(*log) * log_len); | ||
1089 | } | ||
1090 | } | ||
1091 | |||
1092 | static struct ipw_fw_error *ipw_alloc_error_log(struct ipw_priv *priv) | ||
687 | { | 1093 | { |
688 | struct ipw_priv *p = d->driver_data; | 1094 | struct ipw_fw_error *error; |
689 | return sprintf(buf, "0x%08x\n", (int)p->config); | 1095 | u32 log_len = ipw_get_event_log_len(priv); |
1096 | u32 base = ipw_read32(priv, IPW_ERROR_LOG); | ||
1097 | u32 elem_len = ipw_read_reg32(priv, base); | ||
1098 | |||
1099 | error = kmalloc(sizeof(*error) + | ||
1100 | sizeof(*error->elem) * elem_len + | ||
1101 | sizeof(*error->log) * log_len, GFP_ATOMIC); | ||
1102 | if (!error) { | ||
1103 | IPW_ERROR("Memory allocation for firmware error log " | ||
1104 | "failed.\n"); | ||
1105 | return NULL; | ||
1106 | } | ||
1107 | error->jiffies = jiffies; | ||
1108 | error->status = priv->status; | ||
1109 | error->config = priv->config; | ||
1110 | error->elem_len = elem_len; | ||
1111 | error->log_len = log_len; | ||
1112 | error->elem = (struct ipw_error_elem *)error->payload; | ||
1113 | error->log = (struct ipw_event *)(error->elem + | ||
1114 | (sizeof(*error->elem) * elem_len)); | ||
1115 | |||
1116 | ipw_capture_event_log(priv, log_len, error->log); | ||
1117 | |||
1118 | if (elem_len) | ||
1119 | ipw_read_indirect(priv, base + sizeof(base), (u8 *) error->elem, | ||
1120 | sizeof(*error->elem) * elem_len); | ||
1121 | |||
1122 | return error; | ||
690 | } | 1123 | } |
691 | 1124 | ||
692 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); | 1125 | static void ipw_free_error_log(struct ipw_fw_error *error) |
1126 | { | ||
1127 | if (error) | ||
1128 | kfree(error); | ||
1129 | } | ||
693 | 1130 | ||
694 | static ssize_t show_nic_type(struct device *d, | 1131 | static ssize_t show_event_log(struct device *d, |
695 | struct device_attribute *attr, char *buf) | 1132 | struct device_attribute *attr, char *buf) |
696 | { | 1133 | { |
697 | struct ipw_priv *p = d->driver_data; | 1134 | struct ipw_priv *priv = dev_get_drvdata(d); |
698 | u8 type = p->eeprom[EEPROM_NIC_TYPE]; | 1135 | u32 log_len = ipw_get_event_log_len(priv); |
1136 | struct ipw_event log[log_len]; | ||
1137 | u32 len = 0, i; | ||
1138 | |||
1139 | ipw_capture_event_log(priv, log_len, log); | ||
1140 | |||
1141 | len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); | ||
1142 | for (i = 0; i < log_len; i++) | ||
1143 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
1144 | "\n%08X%08X%08X", | ||
1145 | log[i].time, log[i].event, log[i].data); | ||
1146 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | ||
1147 | return len; | ||
1148 | } | ||
699 | 1149 | ||
700 | switch (type) { | 1150 | static DEVICE_ATTR(event_log, S_IRUGO, show_event_log, NULL); |
701 | case EEPROM_NIC_TYPE_STANDARD: | 1151 | |
702 | return sprintf(buf, "STANDARD\n"); | 1152 | static ssize_t show_error(struct device *d, |
703 | case EEPROM_NIC_TYPE_DELL: | 1153 | struct device_attribute *attr, char *buf) |
704 | return sprintf(buf, "DELL\n"); | 1154 | { |
705 | case EEPROM_NIC_TYPE_FUJITSU: | 1155 | struct ipw_priv *priv = dev_get_drvdata(d); |
706 | return sprintf(buf, "FUJITSU\n"); | 1156 | u32 len = 0, i; |
707 | case EEPROM_NIC_TYPE_IBM: | 1157 | if (!priv->error) |
708 | return sprintf(buf, "IBM\n"); | 1158 | return 0; |
709 | case EEPROM_NIC_TYPE_HP: | 1159 | len += snprintf(buf + len, PAGE_SIZE - len, |
710 | return sprintf(buf, "HP\n"); | 1160 | "%08lX%08X%08X%08X", |
1161 | priv->error->jiffies, | ||
1162 | priv->error->status, | ||
1163 | priv->error->config, priv->error->elem_len); | ||
1164 | for (i = 0; i < priv->error->elem_len; i++) | ||
1165 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
1166 | "\n%08X%08X%08X%08X%08X%08X%08X", | ||
1167 | priv->error->elem[i].time, | ||
1168 | priv->error->elem[i].desc, | ||
1169 | priv->error->elem[i].blink1, | ||
1170 | priv->error->elem[i].blink2, | ||
1171 | priv->error->elem[i].link1, | ||
1172 | priv->error->elem[i].link2, | ||
1173 | priv->error->elem[i].data); | ||
1174 | |||
1175 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
1176 | "\n%08X", priv->error->log_len); | ||
1177 | for (i = 0; i < priv->error->log_len; i++) | ||
1178 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
1179 | "\n%08X%08X%08X", | ||
1180 | priv->error->log[i].time, | ||
1181 | priv->error->log[i].event, | ||
1182 | priv->error->log[i].data); | ||
1183 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | ||
1184 | return len; | ||
1185 | } | ||
1186 | |||
1187 | static ssize_t clear_error(struct device *d, | ||
1188 | struct device_attribute *attr, | ||
1189 | const char *buf, size_t count) | ||
1190 | { | ||
1191 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
1192 | if (priv->error) { | ||
1193 | ipw_free_error_log(priv->error); | ||
1194 | priv->error = NULL; | ||
711 | } | 1195 | } |
1196 | return count; | ||
1197 | } | ||
1198 | |||
1199 | static DEVICE_ATTR(error, S_IRUGO | S_IWUSR, show_error, clear_error); | ||
712 | 1200 | ||
713 | return sprintf(buf, "UNKNOWN\n"); | 1201 | static ssize_t show_cmd_log(struct device *d, |
1202 | struct device_attribute *attr, char *buf) | ||
1203 | { | ||
1204 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
1205 | u32 len = 0, i; | ||
1206 | if (!priv->cmdlog) | ||
1207 | return 0; | ||
1208 | for (i = (priv->cmdlog_pos + 1) % priv->cmdlog_len; | ||
1209 | (i != priv->cmdlog_pos) && (PAGE_SIZE - len); | ||
1210 | i = (i + 1) % priv->cmdlog_len) { | ||
1211 | len += | ||
1212 | snprintf(buf + len, PAGE_SIZE - len, | ||
1213 | "\n%08lX%08X%08X%08X\n", priv->cmdlog[i].jiffies, | ||
1214 | priv->cmdlog[i].retcode, priv->cmdlog[i].cmd.cmd, | ||
1215 | priv->cmdlog[i].cmd.len); | ||
1216 | len += | ||
1217 | snprintk_buf(buf + len, PAGE_SIZE - len, | ||
1218 | (u8 *) priv->cmdlog[i].cmd.param, | ||
1219 | priv->cmdlog[i].cmd.len); | ||
1220 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | ||
1221 | } | ||
1222 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | ||
1223 | return len; | ||
714 | } | 1224 | } |
715 | 1225 | ||
716 | static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); | 1226 | static DEVICE_ATTR(cmd_log, S_IRUGO, show_cmd_log, NULL); |
717 | 1227 | ||
718 | static ssize_t dump_error_log(struct device *d, | 1228 | static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, |
719 | struct device_attribute *attr, const char *buf, | 1229 | char *buf) |
720 | size_t count) | ||
721 | { | 1230 | { |
722 | char *p = (char *)buf; | 1231 | struct ipw_priv *priv = dev_get_drvdata(d); |
1232 | return sprintf(buf, "%d\n", priv->ieee->scan_age); | ||
1233 | } | ||
723 | 1234 | ||
724 | if (p[0] == '1') | 1235 | static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, |
725 | ipw_dump_nic_error_log((struct ipw_priv *)d->driver_data); | 1236 | const char *buf, size_t count) |
1237 | { | ||
1238 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
1239 | #ifdef CONFIG_IPW_DEBUG | ||
1240 | struct net_device *dev = priv->net_dev; | ||
1241 | #endif | ||
1242 | char buffer[] = "00000000"; | ||
1243 | unsigned long len = | ||
1244 | (sizeof(buffer) - 1) > count ? count : sizeof(buffer) - 1; | ||
1245 | unsigned long val; | ||
1246 | char *p = buffer; | ||
726 | 1247 | ||
727 | return strnlen(buf, count); | 1248 | IPW_DEBUG_INFO("enter\n"); |
1249 | |||
1250 | strncpy(buffer, buf, len); | ||
1251 | buffer[len] = 0; | ||
1252 | |||
1253 | if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { | ||
1254 | p++; | ||
1255 | if (p[0] == 'x' || p[0] == 'X') | ||
1256 | p++; | ||
1257 | val = simple_strtoul(p, &p, 16); | ||
1258 | } else | ||
1259 | val = simple_strtoul(p, &p, 10); | ||
1260 | if (p == buffer) { | ||
1261 | IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); | ||
1262 | } else { | ||
1263 | priv->ieee->scan_age = val; | ||
1264 | IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); | ||
1265 | } | ||
1266 | |||
1267 | IPW_DEBUG_INFO("exit\n"); | ||
1268 | return len; | ||
728 | } | 1269 | } |
729 | 1270 | ||
730 | static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); | 1271 | static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); |
731 | 1272 | ||
732 | static ssize_t dump_event_log(struct device *d, | 1273 | static ssize_t show_led(struct device *d, struct device_attribute *attr, |
733 | struct device_attribute *attr, const char *buf, | 1274 | char *buf) |
734 | size_t count) | ||
735 | { | 1275 | { |
736 | char *p = (char *)buf; | 1276 | struct ipw_priv *priv = dev_get_drvdata(d); |
1277 | return sprintf(buf, "%d\n", (priv->config & CFG_NO_LED) ? 0 : 1); | ||
1278 | } | ||
737 | 1279 | ||
738 | if (p[0] == '1') | 1280 | static ssize_t store_led(struct device *d, struct device_attribute *attr, |
739 | ipw_dump_nic_event_log((struct ipw_priv *)d->driver_data); | 1281 | const char *buf, size_t count) |
1282 | { | ||
1283 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
740 | 1284 | ||
741 | return strnlen(buf, count); | 1285 | IPW_DEBUG_INFO("enter\n"); |
1286 | |||
1287 | if (count == 0) | ||
1288 | return 0; | ||
1289 | |||
1290 | if (*buf == 0) { | ||
1291 | IPW_DEBUG_LED("Disabling LED control.\n"); | ||
1292 | priv->config |= CFG_NO_LED; | ||
1293 | ipw_led_shutdown(priv); | ||
1294 | } else { | ||
1295 | IPW_DEBUG_LED("Enabling LED control.\n"); | ||
1296 | priv->config &= ~CFG_NO_LED; | ||
1297 | ipw_led_init(priv); | ||
1298 | } | ||
1299 | |||
1300 | IPW_DEBUG_INFO("exit\n"); | ||
1301 | return count; | ||
1302 | } | ||
1303 | |||
1304 | static DEVICE_ATTR(led, S_IWUSR | S_IRUGO, show_led, store_led); | ||
1305 | |||
1306 | static ssize_t show_status(struct device *d, | ||
1307 | struct device_attribute *attr, char *buf) | ||
1308 | { | ||
1309 | struct ipw_priv *p = d->driver_data; | ||
1310 | return sprintf(buf, "0x%08x\n", (int)p->status); | ||
742 | } | 1311 | } |
743 | 1312 | ||
744 | static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); | 1313 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); |
1314 | |||
1315 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | ||
1316 | char *buf) | ||
1317 | { | ||
1318 | struct ipw_priv *p = d->driver_data; | ||
1319 | return sprintf(buf, "0x%08x\n", (int)p->config); | ||
1320 | } | ||
1321 | |||
1322 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); | ||
1323 | |||
1324 | static ssize_t show_nic_type(struct device *d, | ||
1325 | struct device_attribute *attr, char *buf) | ||
1326 | { | ||
1327 | struct ipw_priv *priv = d->driver_data; | ||
1328 | return sprintf(buf, "TYPE: %d\n", priv->nic_type); | ||
1329 | } | ||
1330 | |||
1331 | static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); | ||
745 | 1332 | ||
746 | static ssize_t show_ucode_version(struct device *d, | 1333 | static ssize_t show_ucode_version(struct device *d, |
747 | struct device_attribute *attr, char *buf) | 1334 | struct device_attribute *attr, char *buf) |
@@ -799,7 +1386,7 @@ static ssize_t show_command_event_reg(struct device *d, | |||
799 | u32 reg = 0; | 1386 | u32 reg = 0; |
800 | struct ipw_priv *p = d->driver_data; | 1387 | struct ipw_priv *p = d->driver_data; |
801 | 1388 | ||
802 | reg = ipw_read_reg32(p, CX2_INTERNAL_CMD_EVENT); | 1389 | reg = ipw_read_reg32(p, IPW_INTERNAL_CMD_EVENT); |
803 | return sprintf(buf, "0x%08x\n", reg); | 1390 | return sprintf(buf, "0x%08x\n", reg); |
804 | } | 1391 | } |
805 | static ssize_t store_command_event_reg(struct device *d, | 1392 | static ssize_t store_command_event_reg(struct device *d, |
@@ -810,7 +1397,7 @@ static ssize_t store_command_event_reg(struct device *d, | |||
810 | struct ipw_priv *p = d->driver_data; | 1397 | struct ipw_priv *p = d->driver_data; |
811 | 1398 | ||
812 | sscanf(buf, "%x", ®); | 1399 | sscanf(buf, "%x", ®); |
813 | ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg); | 1400 | ipw_write_reg32(p, IPW_INTERNAL_CMD_EVENT, reg); |
814 | return strnlen(buf, count); | 1401 | return strnlen(buf, count); |
815 | } | 1402 | } |
816 | 1403 | ||
@@ -846,6 +1433,7 @@ static ssize_t show_indirect_dword(struct device *d, | |||
846 | { | 1433 | { |
847 | u32 reg = 0; | 1434 | u32 reg = 0; |
848 | struct ipw_priv *priv = d->driver_data; | 1435 | struct ipw_priv *priv = d->driver_data; |
1436 | |||
849 | if (priv->status & STATUS_INDIRECT_DWORD) | 1437 | if (priv->status & STATUS_INDIRECT_DWORD) |
850 | reg = ipw_read_reg32(priv, priv->indirect_dword); | 1438 | reg = ipw_read_reg32(priv, priv->indirect_dword); |
851 | else | 1439 | else |
@@ -872,6 +1460,7 @@ static ssize_t show_indirect_byte(struct device *d, | |||
872 | { | 1460 | { |
873 | u8 reg = 0; | 1461 | u8 reg = 0; |
874 | struct ipw_priv *priv = d->driver_data; | 1462 | struct ipw_priv *priv = d->driver_data; |
1463 | |||
875 | if (priv->status & STATUS_INDIRECT_BYTE) | 1464 | if (priv->status & STATUS_INDIRECT_BYTE) |
876 | reg = ipw_read_reg8(priv, priv->indirect_byte); | 1465 | reg = ipw_read_reg8(priv, priv->indirect_byte); |
877 | else | 1466 | else |
@@ -946,7 +1535,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, | |||
946 | static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) | 1535 | static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) |
947 | { | 1536 | { |
948 | if ((disable_radio ? 1 : 0) == | 1537 | if ((disable_radio ? 1 : 0) == |
949 | (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) | 1538 | ((priv->status & STATUS_RF_KILL_SW) ? 1 : 0)) |
950 | return 0; | 1539 | return 0; |
951 | 1540 | ||
952 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", | 1541 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", |
@@ -955,10 +1544,8 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) | |||
955 | if (disable_radio) { | 1544 | if (disable_radio) { |
956 | priv->status |= STATUS_RF_KILL_SW; | 1545 | priv->status |= STATUS_RF_KILL_SW; |
957 | 1546 | ||
958 | if (priv->workqueue) { | 1547 | if (priv->workqueue) |
959 | cancel_delayed_work(&priv->request_scan); | 1548 | cancel_delayed_work(&priv->request_scan); |
960 | } | ||
961 | wake_up_interruptible(&priv->wait_command_queue); | ||
962 | queue_work(priv->workqueue, &priv->down); | 1549 | queue_work(priv->workqueue, &priv->down); |
963 | } else { | 1550 | } else { |
964 | priv->status &= ~STATUS_RF_KILL_SW; | 1551 | priv->status &= ~STATUS_RF_KILL_SW; |
@@ -988,6 +1575,93 @@ static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, | |||
988 | 1575 | ||
989 | static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); | 1576 | static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); |
990 | 1577 | ||
1578 | static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr, | ||
1579 | char *buf) | ||
1580 | { | ||
1581 | struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; | ||
1582 | int pos = 0, len = 0; | ||
1583 | if (priv->config & CFG_SPEED_SCAN) { | ||
1584 | while (priv->speed_scan[pos] != 0) | ||
1585 | len += sprintf(&buf[len], "%d ", | ||
1586 | priv->speed_scan[pos++]); | ||
1587 | return len + sprintf(&buf[len], "\n"); | ||
1588 | } | ||
1589 | |||
1590 | return sprintf(buf, "0\n"); | ||
1591 | } | ||
1592 | |||
1593 | static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr, | ||
1594 | const char *buf, size_t count) | ||
1595 | { | ||
1596 | struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; | ||
1597 | int channel, pos = 0; | ||
1598 | const char *p = buf; | ||
1599 | |||
1600 | /* list of space separated channels to scan, optionally ending with 0 */ | ||
1601 | while ((channel = simple_strtol(p, NULL, 0))) { | ||
1602 | if (pos == MAX_SPEED_SCAN - 1) { | ||
1603 | priv->speed_scan[pos] = 0; | ||
1604 | break; | ||
1605 | } | ||
1606 | |||
1607 | if (ipw_is_valid_channel(priv->ieee, channel)) | ||
1608 | priv->speed_scan[pos++] = channel; | ||
1609 | else | ||
1610 | IPW_WARNING("Skipping invalid channel request: %d\n", | ||
1611 | channel); | ||
1612 | p = strchr(p, ' '); | ||
1613 | if (!p) | ||
1614 | break; | ||
1615 | while (*p == ' ' || *p == '\t') | ||
1616 | p++; | ||
1617 | } | ||
1618 | |||
1619 | if (pos == 0) | ||
1620 | priv->config &= ~CFG_SPEED_SCAN; | ||
1621 | else { | ||
1622 | priv->speed_scan_pos = 0; | ||
1623 | priv->config |= CFG_SPEED_SCAN; | ||
1624 | } | ||
1625 | |||
1626 | return count; | ||
1627 | } | ||
1628 | |||
1629 | static DEVICE_ATTR(speed_scan, S_IWUSR | S_IRUGO, show_speed_scan, | ||
1630 | store_speed_scan); | ||
1631 | |||
1632 | static ssize_t show_net_stats(struct device *d, struct device_attribute *attr, | ||
1633 | char *buf) | ||
1634 | { | ||
1635 | struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; | ||
1636 | return sprintf(buf, "%c\n", (priv->config & CFG_NET_STATS) ? '1' : '0'); | ||
1637 | } | ||
1638 | |||
1639 | static ssize_t store_net_stats(struct device *d, struct device_attribute *attr, | ||
1640 | const char *buf, size_t count) | ||
1641 | { | ||
1642 | struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; | ||
1643 | if (buf[0] == '1') | ||
1644 | priv->config |= CFG_NET_STATS; | ||
1645 | else | ||
1646 | priv->config &= ~CFG_NET_STATS; | ||
1647 | |||
1648 | return count; | ||
1649 | } | ||
1650 | |||
1651 | static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, | ||
1652 | show_net_stats, store_net_stats); | ||
1653 | |||
1654 | static void notify_wx_assoc_event(struct ipw_priv *priv) | ||
1655 | { | ||
1656 | union iwreq_data wrqu; | ||
1657 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | ||
1658 | if (priv->status & STATUS_ASSOCIATED) | ||
1659 | memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); | ||
1660 | else | ||
1661 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); | ||
1662 | wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); | ||
1663 | } | ||
1664 | |||
991 | static void ipw_irq_tasklet(struct ipw_priv *priv) | 1665 | static void ipw_irq_tasklet(struct ipw_priv *priv) |
992 | { | 1666 | { |
993 | u32 inta, inta_mask, handled = 0; | 1667 | u32 inta, inta_mask, handled = 0; |
@@ -996,102 +1670,135 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
996 | 1670 | ||
997 | spin_lock_irqsave(&priv->lock, flags); | 1671 | spin_lock_irqsave(&priv->lock, flags); |
998 | 1672 | ||
999 | inta = ipw_read32(priv, CX2_INTA_RW); | 1673 | inta = ipw_read32(priv, IPW_INTA_RW); |
1000 | inta_mask = ipw_read32(priv, CX2_INTA_MASK_R); | 1674 | inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); |
1001 | inta &= (CX2_INTA_MASK_ALL & inta_mask); | 1675 | inta &= (IPW_INTA_MASK_ALL & inta_mask); |
1002 | 1676 | ||
1003 | /* Add any cached INTA values that need to be handled */ | 1677 | /* Add any cached INTA values that need to be handled */ |
1004 | inta |= priv->isr_inta; | 1678 | inta |= priv->isr_inta; |
1005 | 1679 | ||
1006 | /* handle all the justifications for the interrupt */ | 1680 | /* handle all the justifications for the interrupt */ |
1007 | if (inta & CX2_INTA_BIT_RX_TRANSFER) { | 1681 | if (inta & IPW_INTA_BIT_RX_TRANSFER) { |
1008 | ipw_rx(priv); | 1682 | ipw_rx(priv); |
1009 | handled |= CX2_INTA_BIT_RX_TRANSFER; | 1683 | handled |= IPW_INTA_BIT_RX_TRANSFER; |
1010 | } | 1684 | } |
1011 | 1685 | ||
1012 | if (inta & CX2_INTA_BIT_TX_CMD_QUEUE) { | 1686 | if (inta & IPW_INTA_BIT_TX_CMD_QUEUE) { |
1013 | IPW_DEBUG_HC("Command completed.\n"); | 1687 | IPW_DEBUG_HC("Command completed.\n"); |
1014 | rc = ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1); | 1688 | rc = ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1); |
1015 | priv->status &= ~STATUS_HCMD_ACTIVE; | 1689 | priv->status &= ~STATUS_HCMD_ACTIVE; |
1016 | wake_up_interruptible(&priv->wait_command_queue); | 1690 | wake_up_interruptible(&priv->wait_command_queue); |
1017 | handled |= CX2_INTA_BIT_TX_CMD_QUEUE; | 1691 | handled |= IPW_INTA_BIT_TX_CMD_QUEUE; |
1018 | } | 1692 | } |
1019 | 1693 | ||
1020 | if (inta & CX2_INTA_BIT_TX_QUEUE_1) { | 1694 | if (inta & IPW_INTA_BIT_TX_QUEUE_1) { |
1021 | IPW_DEBUG_TX("TX_QUEUE_1\n"); | 1695 | IPW_DEBUG_TX("TX_QUEUE_1\n"); |
1022 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[0], 0); | 1696 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[0], 0); |
1023 | handled |= CX2_INTA_BIT_TX_QUEUE_1; | 1697 | handled |= IPW_INTA_BIT_TX_QUEUE_1; |
1024 | } | 1698 | } |
1025 | 1699 | ||
1026 | if (inta & CX2_INTA_BIT_TX_QUEUE_2) { | 1700 | if (inta & IPW_INTA_BIT_TX_QUEUE_2) { |
1027 | IPW_DEBUG_TX("TX_QUEUE_2\n"); | 1701 | IPW_DEBUG_TX("TX_QUEUE_2\n"); |
1028 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[1], 1); | 1702 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[1], 1); |
1029 | handled |= CX2_INTA_BIT_TX_QUEUE_2; | 1703 | handled |= IPW_INTA_BIT_TX_QUEUE_2; |
1030 | } | 1704 | } |
1031 | 1705 | ||
1032 | if (inta & CX2_INTA_BIT_TX_QUEUE_3) { | 1706 | if (inta & IPW_INTA_BIT_TX_QUEUE_3) { |
1033 | IPW_DEBUG_TX("TX_QUEUE_3\n"); | 1707 | IPW_DEBUG_TX("TX_QUEUE_3\n"); |
1034 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[2], 2); | 1708 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[2], 2); |
1035 | handled |= CX2_INTA_BIT_TX_QUEUE_3; | 1709 | handled |= IPW_INTA_BIT_TX_QUEUE_3; |
1036 | } | 1710 | } |
1037 | 1711 | ||
1038 | if (inta & CX2_INTA_BIT_TX_QUEUE_4) { | 1712 | if (inta & IPW_INTA_BIT_TX_QUEUE_4) { |
1039 | IPW_DEBUG_TX("TX_QUEUE_4\n"); | 1713 | IPW_DEBUG_TX("TX_QUEUE_4\n"); |
1040 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[3], 3); | 1714 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[3], 3); |
1041 | handled |= CX2_INTA_BIT_TX_QUEUE_4; | 1715 | handled |= IPW_INTA_BIT_TX_QUEUE_4; |
1042 | } | 1716 | } |
1043 | 1717 | ||
1044 | if (inta & CX2_INTA_BIT_STATUS_CHANGE) { | 1718 | if (inta & IPW_INTA_BIT_STATUS_CHANGE) { |
1045 | IPW_WARNING("STATUS_CHANGE\n"); | 1719 | IPW_WARNING("STATUS_CHANGE\n"); |
1046 | handled |= CX2_INTA_BIT_STATUS_CHANGE; | 1720 | handled |= IPW_INTA_BIT_STATUS_CHANGE; |
1047 | } | 1721 | } |
1048 | 1722 | ||
1049 | if (inta & CX2_INTA_BIT_BEACON_PERIOD_EXPIRED) { | 1723 | if (inta & IPW_INTA_BIT_BEACON_PERIOD_EXPIRED) { |
1050 | IPW_WARNING("TX_PERIOD_EXPIRED\n"); | 1724 | IPW_WARNING("TX_PERIOD_EXPIRED\n"); |
1051 | handled |= CX2_INTA_BIT_BEACON_PERIOD_EXPIRED; | 1725 | handled |= IPW_INTA_BIT_BEACON_PERIOD_EXPIRED; |
1052 | } | 1726 | } |
1053 | 1727 | ||
1054 | if (inta & CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE) { | 1728 | if (inta & IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE) { |
1055 | IPW_WARNING("HOST_CMD_DONE\n"); | 1729 | IPW_WARNING("HOST_CMD_DONE\n"); |
1056 | handled |= CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE; | 1730 | handled |= IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE; |
1057 | } | 1731 | } |
1058 | 1732 | ||
1059 | if (inta & CX2_INTA_BIT_FW_INITIALIZATION_DONE) { | 1733 | if (inta & IPW_INTA_BIT_FW_INITIALIZATION_DONE) { |
1060 | IPW_WARNING("FW_INITIALIZATION_DONE\n"); | 1734 | IPW_WARNING("FW_INITIALIZATION_DONE\n"); |
1061 | handled |= CX2_INTA_BIT_FW_INITIALIZATION_DONE; | 1735 | handled |= IPW_INTA_BIT_FW_INITIALIZATION_DONE; |
1062 | } | 1736 | } |
1063 | 1737 | ||
1064 | if (inta & CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE) { | 1738 | if (inta & IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE) { |
1065 | IPW_WARNING("PHY_OFF_DONE\n"); | 1739 | IPW_WARNING("PHY_OFF_DONE\n"); |
1066 | handled |= CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE; | 1740 | handled |= IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE; |
1067 | } | 1741 | } |
1068 | 1742 | ||
1069 | if (inta & CX2_INTA_BIT_RF_KILL_DONE) { | 1743 | if (inta & IPW_INTA_BIT_RF_KILL_DONE) { |
1070 | IPW_DEBUG_RF_KILL("RF_KILL_DONE\n"); | 1744 | IPW_DEBUG_RF_KILL("RF_KILL_DONE\n"); |
1071 | priv->status |= STATUS_RF_KILL_HW; | 1745 | priv->status |= STATUS_RF_KILL_HW; |
1072 | wake_up_interruptible(&priv->wait_command_queue); | 1746 | wake_up_interruptible(&priv->wait_command_queue); |
1073 | netif_carrier_off(priv->net_dev); | 1747 | priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); |
1074 | netif_stop_queue(priv->net_dev); | ||
1075 | cancel_delayed_work(&priv->request_scan); | 1748 | cancel_delayed_work(&priv->request_scan); |
1749 | schedule_work(&priv->link_down); | ||
1076 | queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); | 1750 | queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); |
1077 | handled |= CX2_INTA_BIT_RF_KILL_DONE; | 1751 | handled |= IPW_INTA_BIT_RF_KILL_DONE; |
1078 | } | 1752 | } |
1079 | 1753 | ||
1080 | if (inta & CX2_INTA_BIT_FATAL_ERROR) { | 1754 | if (inta & IPW_INTA_BIT_FATAL_ERROR) { |
1081 | IPW_ERROR("Firmware error detected. Restarting.\n"); | 1755 | IPW_ERROR("Firmware error detected. Restarting.\n"); |
1756 | if (priv->error) { | ||
1757 | IPW_ERROR("Sysfs 'error' log already exists.\n"); | ||
1082 | #ifdef CONFIG_IPW_DEBUG | 1758 | #ifdef CONFIG_IPW_DEBUG |
1083 | if (ipw_debug_level & IPW_DL_FW_ERRORS) { | 1759 | if (ipw_debug_level & IPW_DL_FW_ERRORS) { |
1084 | ipw_dump_nic_error_log(priv); | 1760 | struct ipw_fw_error *error = |
1085 | ipw_dump_nic_event_log(priv); | 1761 | ipw_alloc_error_log(priv); |
1086 | } | 1762 | ipw_dump_error_log(priv, error); |
1763 | if (error) | ||
1764 | ipw_free_error_log(error); | ||
1765 | } | ||
1087 | #endif | 1766 | #endif |
1767 | } else { | ||
1768 | priv->error = ipw_alloc_error_log(priv); | ||
1769 | if (priv->error) | ||
1770 | IPW_ERROR("Sysfs 'error' log captured.\n"); | ||
1771 | else | ||
1772 | IPW_ERROR("Error allocating sysfs 'error' " | ||
1773 | "log.\n"); | ||
1774 | #ifdef CONFIG_IPW_DEBUG | ||
1775 | if (ipw_debug_level & IPW_DL_FW_ERRORS) | ||
1776 | ipw_dump_error_log(priv, priv->error); | ||
1777 | #endif | ||
1778 | } | ||
1779 | |||
1780 | /* XXX: If hardware encryption is for WPA/WPA2, | ||
1781 | * we have to notify the supplicant. */ | ||
1782 | if (priv->ieee->sec.encrypt) { | ||
1783 | priv->status &= ~STATUS_ASSOCIATED; | ||
1784 | notify_wx_assoc_event(priv); | ||
1785 | } | ||
1786 | |||
1787 | /* Keep the restart process from trying to send host | ||
1788 | * commands by clearing the INIT status bit */ | ||
1789 | priv->status &= ~STATUS_INIT; | ||
1790 | |||
1791 | /* Cancel currently queued command. */ | ||
1792 | priv->status &= ~STATUS_HCMD_ACTIVE; | ||
1793 | wake_up_interruptible(&priv->wait_command_queue); | ||
1794 | |||
1088 | queue_work(priv->workqueue, &priv->adapter_restart); | 1795 | queue_work(priv->workqueue, &priv->adapter_restart); |
1089 | handled |= CX2_INTA_BIT_FATAL_ERROR; | 1796 | handled |= IPW_INTA_BIT_FATAL_ERROR; |
1090 | } | 1797 | } |
1091 | 1798 | ||
1092 | if (inta & CX2_INTA_BIT_PARITY_ERROR) { | 1799 | if (inta & IPW_INTA_BIT_PARITY_ERROR) { |
1093 | IPW_ERROR("Parity error\n"); | 1800 | IPW_ERROR("Parity error\n"); |
1094 | handled |= CX2_INTA_BIT_PARITY_ERROR; | 1801 | handled |= IPW_INTA_BIT_PARITY_ERROR; |
1095 | } | 1802 | } |
1096 | 1803 | ||
1097 | if (handled != inta) { | 1804 | if (handled != inta) { |
@@ -1104,7 +1811,6 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
1104 | spin_unlock_irqrestore(&priv->lock, flags); | 1811 | spin_unlock_irqrestore(&priv->lock, flags); |
1105 | } | 1812 | } |
1106 | 1813 | ||
1107 | #ifdef CONFIG_IPW_DEBUG | ||
1108 | #define IPW_CMD(x) case IPW_CMD_ ## x : return #x | 1814 | #define IPW_CMD(x) case IPW_CMD_ ## x : return #x |
1109 | static char *get_cmd_string(u8 cmd) | 1815 | static char *get_cmd_string(u8 cmd) |
1110 | { | 1816 | { |
@@ -1163,44 +1869,78 @@ static char *get_cmd_string(u8 cmd) | |||
1163 | return "UNKNOWN"; | 1869 | return "UNKNOWN"; |
1164 | } | 1870 | } |
1165 | } | 1871 | } |
1166 | #endif /* CONFIG_IPW_DEBUG */ | ||
1167 | 1872 | ||
1168 | #define HOST_COMPLETE_TIMEOUT HZ | 1873 | #define HOST_COMPLETE_TIMEOUT HZ |
1169 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | 1874 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) |
1170 | { | 1875 | { |
1171 | int rc = 0; | 1876 | int rc = 0; |
1877 | unsigned long flags; | ||
1172 | 1878 | ||
1879 | spin_lock_irqsave(&priv->lock, flags); | ||
1173 | if (priv->status & STATUS_HCMD_ACTIVE) { | 1880 | if (priv->status & STATUS_HCMD_ACTIVE) { |
1174 | IPW_ERROR("Already sending a command\n"); | 1881 | IPW_ERROR("Failed to send %s: Already sending a command.\n", |
1175 | return -1; | 1882 | get_cmd_string(cmd->cmd)); |
1883 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1884 | return -EAGAIN; | ||
1176 | } | 1885 | } |
1177 | 1886 | ||
1178 | priv->status |= STATUS_HCMD_ACTIVE; | 1887 | priv->status |= STATUS_HCMD_ACTIVE; |
1179 | 1888 | ||
1180 | IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", | 1889 | if (priv->cmdlog) { |
1181 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len); | 1890 | priv->cmdlog[priv->cmdlog_pos].jiffies = jiffies; |
1891 | priv->cmdlog[priv->cmdlog_pos].cmd.cmd = cmd->cmd; | ||
1892 | priv->cmdlog[priv->cmdlog_pos].cmd.len = cmd->len; | ||
1893 | memcpy(priv->cmdlog[priv->cmdlog_pos].cmd.param, cmd->param, | ||
1894 | cmd->len); | ||
1895 | priv->cmdlog[priv->cmdlog_pos].retcode = -1; | ||
1896 | } | ||
1897 | |||
1898 | IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", | ||
1899 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, | ||
1900 | priv->status); | ||
1182 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); | 1901 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); |
1183 | 1902 | ||
1184 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); | 1903 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); |
1185 | if (rc) | 1904 | if (rc) { |
1186 | return rc; | 1905 | priv->status &= ~STATUS_HCMD_ACTIVE; |
1906 | IPW_ERROR("Failed to send %s: Reason %d\n", | ||
1907 | get_cmd_string(cmd->cmd), rc); | ||
1908 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1909 | goto exit; | ||
1910 | } | ||
1911 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1187 | 1912 | ||
1188 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, | 1913 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
1189 | !(priv-> | 1914 | !(priv-> |
1190 | status & STATUS_HCMD_ACTIVE), | 1915 | status & STATUS_HCMD_ACTIVE), |
1191 | HOST_COMPLETE_TIMEOUT); | 1916 | HOST_COMPLETE_TIMEOUT); |
1192 | if (rc == 0) { | 1917 | if (rc == 0) { |
1193 | IPW_DEBUG_INFO("Command completion failed out after %dms.\n", | 1918 | spin_lock_irqsave(&priv->lock, flags); |
1194 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | 1919 | if (priv->status & STATUS_HCMD_ACTIVE) { |
1195 | priv->status &= ~STATUS_HCMD_ACTIVE; | 1920 | IPW_ERROR("Failed to send %s: Command timed out.\n", |
1196 | return -EIO; | 1921 | get_cmd_string(cmd->cmd)); |
1197 | } | 1922 | priv->status &= ~STATUS_HCMD_ACTIVE; |
1198 | if (priv->status & STATUS_RF_KILL_MASK) { | 1923 | spin_unlock_irqrestore(&priv->lock, flags); |
1199 | IPW_DEBUG_INFO("Command aborted due to RF Kill Switch\n"); | 1924 | rc = -EIO; |
1200 | return -EIO; | 1925 | goto exit; |
1926 | } | ||
1927 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1928 | } else | ||
1929 | rc = 0; | ||
1930 | |||
1931 | if (priv->status & STATUS_RF_KILL_HW) { | ||
1932 | IPW_ERROR("Failed to send %s: Aborted due to RF kill switch.\n", | ||
1933 | get_cmd_string(cmd->cmd)); | ||
1934 | rc = -EIO; | ||
1935 | goto exit; | ||
1201 | } | 1936 | } |
1202 | 1937 | ||
1203 | return 0; | 1938 | exit: |
1939 | if (priv->cmdlog) { | ||
1940 | priv->cmdlog[priv->cmdlog_pos++].retcode = rc; | ||
1941 | priv->cmdlog_pos %= priv->cmdlog_len; | ||
1942 | } | ||
1943 | return rc; | ||
1204 | } | 1944 | } |
1205 | 1945 | ||
1206 | static int ipw_send_host_complete(struct ipw_priv *priv) | 1946 | static int ipw_send_host_complete(struct ipw_priv *priv) |
@@ -1215,12 +1955,7 @@ static int ipw_send_host_complete(struct ipw_priv *priv) | |||
1215 | return -1; | 1955 | return -1; |
1216 | } | 1956 | } |
1217 | 1957 | ||
1218 | if (ipw_send_cmd(priv, &cmd)) { | 1958 | return ipw_send_cmd(priv, &cmd); |
1219 | IPW_ERROR("failed to send HOST_COMPLETE command\n"); | ||
1220 | return -1; | ||
1221 | } | ||
1222 | |||
1223 | return 0; | ||
1224 | } | 1959 | } |
1225 | 1960 | ||
1226 | static int ipw_send_system_config(struct ipw_priv *priv, | 1961 | static int ipw_send_system_config(struct ipw_priv *priv, |
@@ -1236,13 +1971,8 @@ static int ipw_send_system_config(struct ipw_priv *priv, | |||
1236 | return -1; | 1971 | return -1; |
1237 | } | 1972 | } |
1238 | 1973 | ||
1239 | memcpy(&cmd.param, config, sizeof(*config)); | 1974 | memcpy(cmd.param, config, sizeof(*config)); |
1240 | if (ipw_send_cmd(priv, &cmd)) { | 1975 | return ipw_send_cmd(priv, &cmd); |
1241 | IPW_ERROR("failed to send SYSTEM_CONFIG command\n"); | ||
1242 | return -1; | ||
1243 | } | ||
1244 | |||
1245 | return 0; | ||
1246 | } | 1976 | } |
1247 | 1977 | ||
1248 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) | 1978 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) |
@@ -1257,13 +1987,8 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) | |||
1257 | return -1; | 1987 | return -1; |
1258 | } | 1988 | } |
1259 | 1989 | ||
1260 | memcpy(&cmd.param, ssid, cmd.len); | 1990 | memcpy(cmd.param, ssid, cmd.len); |
1261 | if (ipw_send_cmd(priv, &cmd)) { | 1991 | return ipw_send_cmd(priv, &cmd); |
1262 | IPW_ERROR("failed to send SSID command\n"); | ||
1263 | return -1; | ||
1264 | } | ||
1265 | |||
1266 | return 0; | ||
1267 | } | 1992 | } |
1268 | 1993 | ||
1269 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | 1994 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) |
@@ -1281,16 +2006,15 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | |||
1281 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", | 2006 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", |
1282 | priv->net_dev->name, MAC_ARG(mac)); | 2007 | priv->net_dev->name, MAC_ARG(mac)); |
1283 | 2008 | ||
1284 | memcpy(&cmd.param, mac, ETH_ALEN); | 2009 | memcpy(cmd.param, mac, ETH_ALEN); |
1285 | 2010 | return ipw_send_cmd(priv, &cmd); | |
1286 | if (ipw_send_cmd(priv, &cmd)) { | ||
1287 | IPW_ERROR("failed to send ADAPTER_ADDRESS command\n"); | ||
1288 | return -1; | ||
1289 | } | ||
1290 | |||
1291 | return 0; | ||
1292 | } | 2011 | } |
1293 | 2012 | ||
2013 | /* | ||
2014 | * NOTE: This must be executed from our workqueue as it results in udelay | ||
2015 | * being called which may corrupt the keyboard if executed on default | ||
2016 | * workqueue | ||
2017 | */ | ||
1294 | static void ipw_adapter_restart(void *adapter) | 2018 | static void ipw_adapter_restart(void *adapter) |
1295 | { | 2019 | { |
1296 | struct ipw_priv *priv = adapter; | 2020 | struct ipw_priv *priv = adapter; |
@@ -1299,12 +2023,25 @@ static void ipw_adapter_restart(void *adapter) | |||
1299 | return; | 2023 | return; |
1300 | 2024 | ||
1301 | ipw_down(priv); | 2025 | ipw_down(priv); |
2026 | |||
2027 | if (priv->assoc_network && | ||
2028 | (priv->assoc_network->capability & WLAN_CAPABILITY_IBSS)) | ||
2029 | ipw_remove_current_network(priv); | ||
2030 | |||
1302 | if (ipw_up(priv)) { | 2031 | if (ipw_up(priv)) { |
1303 | IPW_ERROR("Failed to up device\n"); | 2032 | IPW_ERROR("Failed to up device\n"); |
1304 | return; | 2033 | return; |
1305 | } | 2034 | } |
1306 | } | 2035 | } |
1307 | 2036 | ||
2037 | static void ipw_bg_adapter_restart(void *data) | ||
2038 | { | ||
2039 | struct ipw_priv *priv = data; | ||
2040 | down(&priv->sem); | ||
2041 | ipw_adapter_restart(data); | ||
2042 | up(&priv->sem); | ||
2043 | } | ||
2044 | |||
1308 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) | 2045 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) |
1309 | 2046 | ||
1310 | static void ipw_scan_check(void *data) | 2047 | static void ipw_scan_check(void *data) |
@@ -1314,10 +2051,18 @@ static void ipw_scan_check(void *data) | |||
1314 | IPW_DEBUG_SCAN("Scan completion watchdog resetting " | 2051 | IPW_DEBUG_SCAN("Scan completion watchdog resetting " |
1315 | "adapter (%dms).\n", | 2052 | "adapter (%dms).\n", |
1316 | IPW_SCAN_CHECK_WATCHDOG / 100); | 2053 | IPW_SCAN_CHECK_WATCHDOG / 100); |
1317 | ipw_adapter_restart(priv); | 2054 | queue_work(priv->workqueue, &priv->adapter_restart); |
1318 | } | 2055 | } |
1319 | } | 2056 | } |
1320 | 2057 | ||
2058 | static void ipw_bg_scan_check(void *data) | ||
2059 | { | ||
2060 | struct ipw_priv *priv = data; | ||
2061 | down(&priv->sem); | ||
2062 | ipw_scan_check(data); | ||
2063 | up(&priv->sem); | ||
2064 | } | ||
2065 | |||
1321 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, | 2066 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, |
1322 | struct ipw_scan_request_ext *request) | 2067 | struct ipw_scan_request_ext *request) |
1323 | { | 2068 | { |
@@ -1326,20 +2071,8 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv, | |||
1326 | .len = sizeof(*request) | 2071 | .len = sizeof(*request) |
1327 | }; | 2072 | }; |
1328 | 2073 | ||
1329 | if (!priv || !request) { | 2074 | memcpy(cmd.param, request, sizeof(*request)); |
1330 | IPW_ERROR("Invalid args\n"); | 2075 | return ipw_send_cmd(priv, &cmd); |
1331 | return -1; | ||
1332 | } | ||
1333 | |||
1334 | memcpy(&cmd.param, request, sizeof(*request)); | ||
1335 | if (ipw_send_cmd(priv, &cmd)) { | ||
1336 | IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n"); | ||
1337 | return -1; | ||
1338 | } | ||
1339 | |||
1340 | queue_delayed_work(priv->workqueue, &priv->scan_check, | ||
1341 | IPW_SCAN_CHECK_WATCHDOG); | ||
1342 | return 0; | ||
1343 | } | 2076 | } |
1344 | 2077 | ||
1345 | static int ipw_send_scan_abort(struct ipw_priv *priv) | 2078 | static int ipw_send_scan_abort(struct ipw_priv *priv) |
@@ -1354,12 +2087,7 @@ static int ipw_send_scan_abort(struct ipw_priv *priv) | |||
1354 | return -1; | 2087 | return -1; |
1355 | } | 2088 | } |
1356 | 2089 | ||
1357 | if (ipw_send_cmd(priv, &cmd)) { | 2090 | return ipw_send_cmd(priv, &cmd); |
1358 | IPW_ERROR("failed to send SCAN_ABORT command\n"); | ||
1359 | return -1; | ||
1360 | } | ||
1361 | |||
1362 | return 0; | ||
1363 | } | 2091 | } |
1364 | 2092 | ||
1365 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) | 2093 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) |
@@ -1371,12 +2099,7 @@ static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) | |||
1371 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) | 2099 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) |
1372 | &cmd.param; | 2100 | &cmd.param; |
1373 | calib->beacon_rssi_raw = sens; | 2101 | calib->beacon_rssi_raw = sens; |
1374 | if (ipw_send_cmd(priv, &cmd)) { | 2102 | return ipw_send_cmd(priv, &cmd); |
1375 | IPW_ERROR("failed to send SENSITIVITY CALIB command\n"); | ||
1376 | return -1; | ||
1377 | } | ||
1378 | |||
1379 | return 0; | ||
1380 | } | 2103 | } |
1381 | 2104 | ||
1382 | static int ipw_send_associate(struct ipw_priv *priv, | 2105 | static int ipw_send_associate(struct ipw_priv *priv, |
@@ -1387,18 +2110,26 @@ static int ipw_send_associate(struct ipw_priv *priv, | |||
1387 | .len = sizeof(*associate) | 2110 | .len = sizeof(*associate) |
1388 | }; | 2111 | }; |
1389 | 2112 | ||
2113 | struct ipw_associate tmp_associate; | ||
2114 | memcpy(&tmp_associate, associate, sizeof(*associate)); | ||
2115 | tmp_associate.policy_support = | ||
2116 | cpu_to_le16(tmp_associate.policy_support); | ||
2117 | tmp_associate.assoc_tsf_msw = cpu_to_le32(tmp_associate.assoc_tsf_msw); | ||
2118 | tmp_associate.assoc_tsf_lsw = cpu_to_le32(tmp_associate.assoc_tsf_lsw); | ||
2119 | tmp_associate.capability = cpu_to_le16(tmp_associate.capability); | ||
2120 | tmp_associate.listen_interval = | ||
2121 | cpu_to_le16(tmp_associate.listen_interval); | ||
2122 | tmp_associate.beacon_interval = | ||
2123 | cpu_to_le16(tmp_associate.beacon_interval); | ||
2124 | tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); | ||
2125 | |||
1390 | if (!priv || !associate) { | 2126 | if (!priv || !associate) { |
1391 | IPW_ERROR("Invalid args\n"); | 2127 | IPW_ERROR("Invalid args\n"); |
1392 | return -1; | 2128 | return -1; |
1393 | } | 2129 | } |
1394 | 2130 | ||
1395 | memcpy(&cmd.param, associate, sizeof(*associate)); | 2131 | memcpy(cmd.param, &tmp_associate, sizeof(*associate)); |
1396 | if (ipw_send_cmd(priv, &cmd)) { | 2132 | return ipw_send_cmd(priv, &cmd); |
1397 | IPW_ERROR("failed to send ASSOCIATE command\n"); | ||
1398 | return -1; | ||
1399 | } | ||
1400 | |||
1401 | return 0; | ||
1402 | } | 2133 | } |
1403 | 2134 | ||
1404 | static int ipw_send_supported_rates(struct ipw_priv *priv, | 2135 | static int ipw_send_supported_rates(struct ipw_priv *priv, |
@@ -1414,13 +2145,8 @@ static int ipw_send_supported_rates(struct ipw_priv *priv, | |||
1414 | return -1; | 2145 | return -1; |
1415 | } | 2146 | } |
1416 | 2147 | ||
1417 | memcpy(&cmd.param, rates, sizeof(*rates)); | 2148 | memcpy(cmd.param, rates, sizeof(*rates)); |
1418 | if (ipw_send_cmd(priv, &cmd)) { | 2149 | return ipw_send_cmd(priv, &cmd); |
1419 | IPW_ERROR("failed to send SUPPORTED_RATES command\n"); | ||
1420 | return -1; | ||
1421 | } | ||
1422 | |||
1423 | return 0; | ||
1424 | } | 2150 | } |
1425 | 2151 | ||
1426 | static int ipw_set_random_seed(struct ipw_priv *priv) | 2152 | static int ipw_set_random_seed(struct ipw_priv *priv) |
@@ -1437,15 +2163,9 @@ static int ipw_set_random_seed(struct ipw_priv *priv) | |||
1437 | 2163 | ||
1438 | get_random_bytes(&cmd.param, sizeof(u32)); | 2164 | get_random_bytes(&cmd.param, sizeof(u32)); |
1439 | 2165 | ||
1440 | if (ipw_send_cmd(priv, &cmd)) { | 2166 | return ipw_send_cmd(priv, &cmd); |
1441 | IPW_ERROR("failed to send SEED_NUMBER command\n"); | ||
1442 | return -1; | ||
1443 | } | ||
1444 | |||
1445 | return 0; | ||
1446 | } | 2167 | } |
1447 | 2168 | ||
1448 | #if 0 | ||
1449 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | 2169 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) |
1450 | { | 2170 | { |
1451 | struct host_cmd cmd = { | 2171 | struct host_cmd cmd = { |
@@ -1460,14 +2180,8 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | |||
1460 | 2180 | ||
1461 | *((u32 *) & cmd.param) = phy_off; | 2181 | *((u32 *) & cmd.param) = phy_off; |
1462 | 2182 | ||
1463 | if (ipw_send_cmd(priv, &cmd)) { | 2183 | return ipw_send_cmd(priv, &cmd); |
1464 | IPW_ERROR("failed to send CARD_DISABLE command\n"); | ||
1465 | return -1; | ||
1466 | } | ||
1467 | |||
1468 | return 0; | ||
1469 | } | 2184 | } |
1470 | #endif | ||
1471 | 2185 | ||
1472 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) | 2186 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) |
1473 | { | 2187 | { |
@@ -1481,12 +2195,51 @@ static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) | |||
1481 | return -1; | 2195 | return -1; |
1482 | } | 2196 | } |
1483 | 2197 | ||
1484 | memcpy(&cmd.param, power, sizeof(*power)); | 2198 | memcpy(cmd.param, power, sizeof(*power)); |
1485 | if (ipw_send_cmd(priv, &cmd)) { | 2199 | return ipw_send_cmd(priv, &cmd); |
1486 | IPW_ERROR("failed to send TX_POWER command\n"); | 2200 | } |
1487 | return -1; | 2201 | |
2202 | static int ipw_set_tx_power(struct ipw_priv *priv) | ||
2203 | { | ||
2204 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | ||
2205 | struct ipw_tx_power tx_power; | ||
2206 | s8 max_power; | ||
2207 | int i; | ||
2208 | |||
2209 | memset(&tx_power, 0, sizeof(tx_power)); | ||
2210 | |||
2211 | /* configure device for 'G' band */ | ||
2212 | tx_power.ieee_mode = IPW_G_MODE; | ||
2213 | tx_power.num_channels = geo->bg_channels; | ||
2214 | for (i = 0; i < geo->bg_channels; i++) { | ||
2215 | max_power = geo->bg[i].max_power; | ||
2216 | tx_power.channels_tx_power[i].channel_number = | ||
2217 | geo->bg[i].channel; | ||
2218 | tx_power.channels_tx_power[i].tx_power = max_power ? | ||
2219 | min(max_power, priv->tx_power) : priv->tx_power; | ||
1488 | } | 2220 | } |
2221 | if (ipw_send_tx_power(priv, &tx_power)) | ||
2222 | return -EIO; | ||
2223 | |||
2224 | /* configure device to also handle 'B' band */ | ||
2225 | tx_power.ieee_mode = IPW_B_MODE; | ||
2226 | if (ipw_send_tx_power(priv, &tx_power)) | ||
2227 | return -EIO; | ||
1489 | 2228 | ||
2229 | /* configure device to also handle 'A' band */ | ||
2230 | if (priv->ieee->abg_true) { | ||
2231 | tx_power.ieee_mode = IPW_A_MODE; | ||
2232 | tx_power.num_channels = geo->a_channels; | ||
2233 | for (i = 0; i < tx_power.num_channels; i++) { | ||
2234 | max_power = geo->a[i].max_power; | ||
2235 | tx_power.channels_tx_power[i].channel_number = | ||
2236 | geo->a[i].channel; | ||
2237 | tx_power.channels_tx_power[i].tx_power = max_power ? | ||
2238 | min(max_power, priv->tx_power) : priv->tx_power; | ||
2239 | } | ||
2240 | if (ipw_send_tx_power(priv, &tx_power)) | ||
2241 | return -EIO; | ||
2242 | } | ||
1490 | return 0; | 2243 | return 0; |
1491 | } | 2244 | } |
1492 | 2245 | ||
@@ -1505,13 +2258,8 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) | |||
1505 | return -1; | 2258 | return -1; |
1506 | } | 2259 | } |
1507 | 2260 | ||
1508 | memcpy(&cmd.param, &rts_threshold, sizeof(rts_threshold)); | 2261 | memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); |
1509 | if (ipw_send_cmd(priv, &cmd)) { | 2262 | return ipw_send_cmd(priv, &cmd); |
1510 | IPW_ERROR("failed to send RTS_THRESHOLD command\n"); | ||
1511 | return -1; | ||
1512 | } | ||
1513 | |||
1514 | return 0; | ||
1515 | } | 2263 | } |
1516 | 2264 | ||
1517 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | 2265 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) |
@@ -1529,13 +2277,8 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | |||
1529 | return -1; | 2277 | return -1; |
1530 | } | 2278 | } |
1531 | 2279 | ||
1532 | memcpy(&cmd.param, &frag_threshold, sizeof(frag_threshold)); | 2280 | memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); |
1533 | if (ipw_send_cmd(priv, &cmd)) { | 2281 | return ipw_send_cmd(priv, &cmd); |
1534 | IPW_ERROR("failed to send FRAG_THRESHOLD command\n"); | ||
1535 | return -1; | ||
1536 | } | ||
1537 | |||
1538 | return 0; | ||
1539 | } | 2282 | } |
1540 | 2283 | ||
1541 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | 2284 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) |
@@ -1565,12 +2308,27 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | |||
1565 | break; | 2308 | break; |
1566 | } | 2309 | } |
1567 | 2310 | ||
1568 | if (ipw_send_cmd(priv, &cmd)) { | 2311 | return ipw_send_cmd(priv, &cmd); |
1569 | IPW_ERROR("failed to send POWER_MODE command\n"); | 2312 | } |
2313 | |||
2314 | static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) | ||
2315 | { | ||
2316 | struct ipw_retry_limit retry_limit = { | ||
2317 | .short_retry_limit = slimit, | ||
2318 | .long_retry_limit = llimit | ||
2319 | }; | ||
2320 | struct host_cmd cmd = { | ||
2321 | .cmd = IPW_CMD_RETRY_LIMIT, | ||
2322 | .len = sizeof(retry_limit) | ||
2323 | }; | ||
2324 | |||
2325 | if (!priv) { | ||
2326 | IPW_ERROR("Invalid args\n"); | ||
1570 | return -1; | 2327 | return -1; |
1571 | } | 2328 | } |
1572 | 2329 | ||
1573 | return 0; | 2330 | memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); |
2331 | return ipw_send_cmd(priv, &cmd); | ||
1574 | } | 2332 | } |
1575 | 2333 | ||
1576 | /* | 2334 | /* |
@@ -1672,8 +2430,7 @@ static u16 eeprom_read_u16(struct ipw_priv *priv, u8 addr) | |||
1672 | /* data's copy of the eeprom data */ | 2430 | /* data's copy of the eeprom data */ |
1673 | static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) | 2431 | static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) |
1674 | { | 2432 | { |
1675 | u8 *ee = (u8 *) priv->eeprom; | 2433 | memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6); |
1676 | memcpy(mac, &ee[EEPROM_MAC_ADDRESS], 6); | ||
1677 | } | 2434 | } |
1678 | 2435 | ||
1679 | /* | 2436 | /* |
@@ -1693,7 +2450,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) | |||
1693 | 2450 | ||
1694 | /* read entire contents of eeprom into private buffer */ | 2451 | /* read entire contents of eeprom into private buffer */ |
1695 | for (i = 0; i < 128; i++) | 2452 | for (i = 0; i < 128; i++) |
1696 | eeprom[i] = eeprom_read_u16(priv, (u8) i); | 2453 | eeprom[i] = le16_to_cpu(eeprom_read_u16(priv, (u8) i)); |
1697 | 2454 | ||
1698 | /* | 2455 | /* |
1699 | If the data looks correct, then copy it to our private | 2456 | If the data looks correct, then copy it to our private |
@@ -1704,7 +2461,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) | |||
1704 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); | 2461 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); |
1705 | 2462 | ||
1706 | /* write the eeprom data to sram */ | 2463 | /* write the eeprom data to sram */ |
1707 | for (i = 0; i < CX2_EEPROM_IMAGE_SIZE; i++) | 2464 | for (i = 0; i < IPW_EEPROM_IMAGE_SIZE; i++) |
1708 | ipw_write8(priv, IPW_EEPROM_DATA + i, priv->eeprom[i]); | 2465 | ipw_write8(priv, IPW_EEPROM_DATA + i, priv->eeprom[i]); |
1709 | 2466 | ||
1710 | /* Do not load eeprom data on fatal error or suspend */ | 2467 | /* Do not load eeprom data on fatal error or suspend */ |
@@ -1724,14 +2481,14 @@ static inline void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count) | |||
1724 | count >>= 2; | 2481 | count >>= 2; |
1725 | if (!count) | 2482 | if (!count) |
1726 | return; | 2483 | return; |
1727 | _ipw_write32(priv, CX2_AUTOINC_ADDR, start); | 2484 | _ipw_write32(priv, IPW_AUTOINC_ADDR, start); |
1728 | while (count--) | 2485 | while (count--) |
1729 | _ipw_write32(priv, CX2_AUTOINC_DATA, 0); | 2486 | _ipw_write32(priv, IPW_AUTOINC_DATA, 0); |
1730 | } | 2487 | } |
1731 | 2488 | ||
1732 | static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv) | 2489 | static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv) |
1733 | { | 2490 | { |
1734 | ipw_zero_memory(priv, CX2_SHARED_SRAM_DMA_CONTROL, | 2491 | ipw_zero_memory(priv, IPW_SHARED_SRAM_DMA_CONTROL, |
1735 | CB_NUMBER_OF_ELEMENTS_SMALL * | 2492 | CB_NUMBER_OF_ELEMENTS_SMALL * |
1736 | sizeof(struct command_block)); | 2493 | sizeof(struct command_block)); |
1737 | } | 2494 | } |
@@ -1745,7 +2502,7 @@ static int ipw_fw_dma_enable(struct ipw_priv *priv) | |||
1745 | ipw_fw_dma_reset_command_blocks(priv); | 2502 | ipw_fw_dma_reset_command_blocks(priv); |
1746 | 2503 | ||
1747 | /* Write CB base address */ | 2504 | /* Write CB base address */ |
1748 | ipw_write_reg32(priv, CX2_DMA_I_CB_BASE, CX2_SHARED_SRAM_DMA_CONTROL); | 2505 | ipw_write_reg32(priv, IPW_DMA_I_CB_BASE, IPW_SHARED_SRAM_DMA_CONTROL); |
1749 | 2506 | ||
1750 | IPW_DEBUG_FW("<< : \n"); | 2507 | IPW_DEBUG_FW("<< : \n"); |
1751 | return 0; | 2508 | return 0; |
@@ -1759,7 +2516,7 @@ static void ipw_fw_dma_abort(struct ipw_priv *priv) | |||
1759 | 2516 | ||
1760 | //set the Stop and Abort bit | 2517 | //set the Stop and Abort bit |
1761 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; | 2518 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; |
1762 | ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); | 2519 | ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); |
1763 | priv->sram_desc.last_cb_index = 0; | 2520 | priv->sram_desc.last_cb_index = 0; |
1764 | 2521 | ||
1765 | IPW_DEBUG_FW("<< \n"); | 2522 | IPW_DEBUG_FW("<< \n"); |
@@ -1769,7 +2526,7 @@ static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, | |||
1769 | struct command_block *cb) | 2526 | struct command_block *cb) |
1770 | { | 2527 | { |
1771 | u32 address = | 2528 | u32 address = |
1772 | CX2_SHARED_SRAM_DMA_CONTROL + | 2529 | IPW_SHARED_SRAM_DMA_CONTROL + |
1773 | (sizeof(struct command_block) * index); | 2530 | (sizeof(struct command_block) * index); |
1774 | IPW_DEBUG_FW(">> :\n"); | 2531 | IPW_DEBUG_FW(">> :\n"); |
1775 | 2532 | ||
@@ -1793,13 +2550,13 @@ static int ipw_fw_dma_kick(struct ipw_priv *priv) | |||
1793 | &priv->sram_desc.cb_list[index]); | 2550 | &priv->sram_desc.cb_list[index]); |
1794 | 2551 | ||
1795 | /* Enable the DMA in the CSR register */ | 2552 | /* Enable the DMA in the CSR register */ |
1796 | ipw_clear_bit(priv, CX2_RESET_REG, | 2553 | ipw_clear_bit(priv, IPW_RESET_REG, |
1797 | CX2_RESET_REG_MASTER_DISABLED | | 2554 | IPW_RESET_REG_MASTER_DISABLED | |
1798 | CX2_RESET_REG_STOP_MASTER); | 2555 | IPW_RESET_REG_STOP_MASTER); |
1799 | 2556 | ||
1800 | /* Set the Start bit. */ | 2557 | /* Set the Start bit. */ |
1801 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; | 2558 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; |
1802 | ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); | 2559 | ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); |
1803 | 2560 | ||
1804 | IPW_DEBUG_FW("<< :\n"); | 2561 | IPW_DEBUG_FW("<< :\n"); |
1805 | return 0; | 2562 | return 0; |
@@ -1812,12 +2569,12 @@ static void ipw_fw_dma_dump_command_block(struct ipw_priv *priv) | |||
1812 | u32 cb_fields_address = 0; | 2569 | u32 cb_fields_address = 0; |
1813 | 2570 | ||
1814 | IPW_DEBUG_FW(">> :\n"); | 2571 | IPW_DEBUG_FW(">> :\n"); |
1815 | address = ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); | 2572 | address = ipw_read_reg32(priv, IPW_DMA_I_CURRENT_CB); |
1816 | IPW_DEBUG_FW_INFO("Current CB is 0x%x \n", address); | 2573 | IPW_DEBUG_FW_INFO("Current CB is 0x%x \n", address); |
1817 | 2574 | ||
1818 | /* Read the DMA Controlor register */ | 2575 | /* Read the DMA Controlor register */ |
1819 | register_value = ipw_read_reg32(priv, CX2_DMA_I_DMA_CONTROL); | 2576 | register_value = ipw_read_reg32(priv, IPW_DMA_I_DMA_CONTROL); |
1820 | IPW_DEBUG_FW_INFO("CX2_DMA_I_DMA_CONTROL is 0x%x \n", register_value); | 2577 | IPW_DEBUG_FW_INFO("IPW_DMA_I_DMA_CONTROL is 0x%x \n", register_value); |
1821 | 2578 | ||
1822 | /* Print the CB values */ | 2579 | /* Print the CB values */ |
1823 | cb_fields_address = address; | 2580 | cb_fields_address = address; |
@@ -1846,9 +2603,9 @@ static int ipw_fw_dma_command_block_index(struct ipw_priv *priv) | |||
1846 | u32 current_cb_index = 0; | 2603 | u32 current_cb_index = 0; |
1847 | 2604 | ||
1848 | IPW_DEBUG_FW("<< :\n"); | 2605 | IPW_DEBUG_FW("<< :\n"); |
1849 | current_cb_address = ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); | 2606 | current_cb_address = ipw_read_reg32(priv, IPW_DMA_I_CURRENT_CB); |
1850 | 2607 | ||
1851 | current_cb_index = (current_cb_address - CX2_SHARED_SRAM_DMA_CONTROL) / | 2608 | current_cb_index = (current_cb_address - IPW_SHARED_SRAM_DMA_CONTROL) / |
1852 | sizeof(struct command_block); | 2609 | sizeof(struct command_block); |
1853 | 2610 | ||
1854 | IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n", | 2611 | IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n", |
@@ -1977,8 +2734,8 @@ static int ipw_fw_dma_wait(struct ipw_priv *priv) | |||
1977 | ipw_fw_dma_abort(priv); | 2734 | ipw_fw_dma_abort(priv); |
1978 | 2735 | ||
1979 | /*Disable the DMA in the CSR register */ | 2736 | /*Disable the DMA in the CSR register */ |
1980 | ipw_set_bit(priv, CX2_RESET_REG, | 2737 | ipw_set_bit(priv, IPW_RESET_REG, |
1981 | CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER); | 2738 | IPW_RESET_REG_MASTER_DISABLED | IPW_RESET_REG_STOP_MASTER); |
1982 | 2739 | ||
1983 | IPW_DEBUG_FW("<< dmaWaitSync \n"); | 2740 | IPW_DEBUG_FW("<< dmaWaitSync \n"); |
1984 | return 0; | 2741 | return 0; |
@@ -1988,6 +2745,9 @@ static void ipw_remove_current_network(struct ipw_priv *priv) | |||
1988 | { | 2745 | { |
1989 | struct list_head *element, *safe; | 2746 | struct list_head *element, *safe; |
1990 | struct ieee80211_network *network = NULL; | 2747 | struct ieee80211_network *network = NULL; |
2748 | unsigned long flags; | ||
2749 | |||
2750 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
1991 | list_for_each_safe(element, safe, &priv->ieee->network_list) { | 2751 | list_for_each_safe(element, safe, &priv->ieee->network_list) { |
1992 | network = list_entry(element, struct ieee80211_network, list); | 2752 | network = list_entry(element, struct ieee80211_network, list); |
1993 | if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { | 2753 | if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { |
@@ -1996,6 +2756,7 @@ static void ipw_remove_current_network(struct ipw_priv *priv) | |||
1996 | &priv->ieee->network_free_list); | 2756 | &priv->ieee->network_free_list); |
1997 | } | 2757 | } |
1998 | } | 2758 | } |
2759 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
1999 | } | 2760 | } |
2000 | 2761 | ||
2001 | /** | 2762 | /** |
@@ -2038,10 +2799,10 @@ static int ipw_stop_master(struct ipw_priv *priv) | |||
2038 | 2799 | ||
2039 | IPW_DEBUG_TRACE(">> \n"); | 2800 | IPW_DEBUG_TRACE(">> \n"); |
2040 | /* stop master. typical delay - 0 */ | 2801 | /* stop master. typical delay - 0 */ |
2041 | ipw_set_bit(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); | 2802 | ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); |
2042 | 2803 | ||
2043 | rc = ipw_poll_bit(priv, CX2_RESET_REG, | 2804 | rc = ipw_poll_bit(priv, IPW_RESET_REG, |
2044 | CX2_RESET_REG_MASTER_DISABLED, 100); | 2805 | IPW_RESET_REG_MASTER_DISABLED, 100); |
2045 | if (rc < 0) { | 2806 | if (rc < 0) { |
2046 | IPW_ERROR("stop master failed in 10ms\n"); | 2807 | IPW_ERROR("stop master failed in 10ms\n"); |
2047 | return -1; | 2808 | return -1; |
@@ -2057,7 +2818,7 @@ static void ipw_arc_release(struct ipw_priv *priv) | |||
2057 | IPW_DEBUG_TRACE(">> \n"); | 2818 | IPW_DEBUG_TRACE(">> \n"); |
2058 | mdelay(5); | 2819 | mdelay(5); |
2059 | 2820 | ||
2060 | ipw_clear_bit(priv, CX2_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); | 2821 | ipw_clear_bit(priv, IPW_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); |
2061 | 2822 | ||
2062 | /* no one knows timing, for safety add some delay */ | 2823 | /* no one knows timing, for safety add some delay */ |
2063 | mdelay(5); | 2824 | mdelay(5); |
@@ -2074,13 +2835,12 @@ struct fw_chunk { | |||
2074 | }; | 2835 | }; |
2075 | 2836 | ||
2076 | #define IPW_FW_MAJOR_VERSION 2 | 2837 | #define IPW_FW_MAJOR_VERSION 2 |
2077 | #define IPW_FW_MINOR_VERSION 2 | 2838 | #define IPW_FW_MINOR_VERSION 4 |
2078 | 2839 | ||
2079 | #define IPW_FW_MINOR(x) ((x & 0xff) >> 8) | 2840 | #define IPW_FW_MINOR(x) ((x & 0xff) >> 8) |
2080 | #define IPW_FW_MAJOR(x) (x & 0xff) | 2841 | #define IPW_FW_MAJOR(x) (x & 0xff) |
2081 | 2842 | ||
2082 | #define IPW_FW_VERSION ((IPW_FW_MINOR_VERSION << 8) | \ | 2843 | #define IPW_FW_VERSION ((IPW_FW_MINOR_VERSION << 8) | IPW_FW_MAJOR_VERSION) |
2083 | IPW_FW_MAJOR_VERSION) | ||
2084 | 2844 | ||
2085 | #define IPW_FW_PREFIX "ipw-" __stringify(IPW_FW_MAJOR_VERSION) \ | 2845 | #define IPW_FW_PREFIX "ipw-" __stringify(IPW_FW_MAJOR_VERSION) \ |
2086 | "." __stringify(IPW_FW_MINOR_VERSION) "-" | 2846 | "." __stringify(IPW_FW_MINOR_VERSION) "-" |
@@ -2108,8 +2868,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2108 | 2868 | ||
2109 | // spin_lock_irqsave(&priv->lock, flags); | 2869 | // spin_lock_irqsave(&priv->lock, flags); |
2110 | 2870 | ||
2111 | for (addr = CX2_SHARED_LOWER_BOUND; | 2871 | for (addr = IPW_SHARED_LOWER_BOUND; |
2112 | addr < CX2_REGISTER_DOMAIN1_END; addr += 4) { | 2872 | addr < IPW_REGISTER_DOMAIN1_END; addr += 4) { |
2113 | ipw_write32(priv, addr, 0); | 2873 | ipw_write32(priv, addr, 0); |
2114 | } | 2874 | } |
2115 | 2875 | ||
@@ -2118,16 +2878,16 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2118 | /* destroy DMA queues */ | 2878 | /* destroy DMA queues */ |
2119 | /* reset sequence */ | 2879 | /* reset sequence */ |
2120 | 2880 | ||
2121 | ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_ON); | 2881 | ipw_write_reg32(priv, IPW_MEM_HALT_AND_RESET, IPW_BIT_HALT_RESET_ON); |
2122 | ipw_arc_release(priv); | 2882 | ipw_arc_release(priv); |
2123 | ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_OFF); | 2883 | ipw_write_reg32(priv, IPW_MEM_HALT_AND_RESET, IPW_BIT_HALT_RESET_OFF); |
2124 | mdelay(1); | 2884 | mdelay(1); |
2125 | 2885 | ||
2126 | /* reset PHY */ | 2886 | /* reset PHY */ |
2127 | ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, CX2_BASEBAND_POWER_DOWN); | 2887 | ipw_write_reg32(priv, IPW_INTERNAL_CMD_EVENT, IPW_BASEBAND_POWER_DOWN); |
2128 | mdelay(1); | 2888 | mdelay(1); |
2129 | 2889 | ||
2130 | ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, 0); | 2890 | ipw_write_reg32(priv, IPW_INTERNAL_CMD_EVENT, 0); |
2131 | mdelay(1); | 2891 | mdelay(1); |
2132 | 2892 | ||
2133 | /* enable ucode store */ | 2893 | /* enable ucode store */ |
@@ -2145,18 +2905,19 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2145 | */ | 2905 | */ |
2146 | /* load new ipw uCode */ | 2906 | /* load new ipw uCode */ |
2147 | for (i = 0; i < len / 2; i++) | 2907 | for (i = 0; i < len / 2; i++) |
2148 | ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, image[i]); | 2908 | ipw_write_reg16(priv, IPW_BASEBAND_CONTROL_STORE, |
2909 | cpu_to_le16(image[i])); | ||
2149 | 2910 | ||
2150 | /* enable DINO */ | 2911 | /* enable DINO */ |
2151 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); | 2912 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); |
2152 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, DINO_ENABLE_SYSTEM); | 2913 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_SYSTEM); |
2153 | 2914 | ||
2154 | /* this is where the igx / win driver deveates from the VAP driver. */ | 2915 | /* this is where the igx / win driver deveates from the VAP driver. */ |
2155 | 2916 | ||
2156 | /* wait for alive response */ | 2917 | /* wait for alive response */ |
2157 | for (i = 0; i < 100; i++) { | 2918 | for (i = 0; i < 100; i++) { |
2158 | /* poll for incoming data */ | 2919 | /* poll for incoming data */ |
2159 | cr = ipw_read_reg8(priv, CX2_BASEBAND_CONTROL_STATUS); | 2920 | cr = ipw_read_reg8(priv, IPW_BASEBAND_CONTROL_STATUS); |
2160 | if (cr & DINO_RXFIFO_DATA) | 2921 | if (cr & DINO_RXFIFO_DATA) |
2161 | break; | 2922 | break; |
2162 | mdelay(1); | 2923 | mdelay(1); |
@@ -2168,7 +2929,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2168 | 2929 | ||
2169 | for (i = 0; i < ARRAY_SIZE(response_buffer); i++) | 2930 | for (i = 0; i < ARRAY_SIZE(response_buffer); i++) |
2170 | response_buffer[i] = | 2931 | response_buffer[i] = |
2171 | ipw_read_reg32(priv, CX2_BASEBAND_RX_FIFO_READ); | 2932 | le32_to_cpu(ipw_read_reg32(priv, |
2933 | IPW_BASEBAND_RX_FIFO_READ)); | ||
2172 | memcpy(&priv->dino_alive, response_buffer, | 2934 | memcpy(&priv->dino_alive, response_buffer, |
2173 | sizeof(priv->dino_alive)); | 2935 | sizeof(priv->dino_alive)); |
2174 | if (priv->dino_alive.alive_command == 1 | 2936 | if (priv->dino_alive.alive_command == 1 |
@@ -2197,7 +2959,7 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2197 | 2959 | ||
2198 | /* disable DINO, otherwise for some reason | 2960 | /* disable DINO, otherwise for some reason |
2199 | firmware have problem getting alive resp. */ | 2961 | firmware have problem getting alive resp. */ |
2200 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); | 2962 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); |
2201 | 2963 | ||
2202 | // spin_unlock_irqrestore(&priv->lock, flags); | 2964 | // spin_unlock_irqrestore(&priv->lock, flags); |
2203 | 2965 | ||
@@ -2237,13 +2999,14 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) | |||
2237 | * offeset*/ | 2999 | * offeset*/ |
2238 | /* Dma loading */ | 3000 | /* Dma loading */ |
2239 | rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, | 3001 | rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, |
2240 | chunk->address, chunk->length); | 3002 | le32_to_cpu(chunk->address), |
3003 | le32_to_cpu(chunk->length)); | ||
2241 | if (rc) { | 3004 | if (rc) { |
2242 | IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); | 3005 | IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); |
2243 | goto out; | 3006 | goto out; |
2244 | } | 3007 | } |
2245 | 3008 | ||
2246 | offset += chunk->length; | 3009 | offset += le32_to_cpu(chunk->length); |
2247 | } while (offset < len); | 3010 | } while (offset < len); |
2248 | 3011 | ||
2249 | /* Run the DMA and wait for the answer */ | 3012 | /* Run the DMA and wait for the answer */ |
@@ -2269,16 +3032,16 @@ static int ipw_stop_nic(struct ipw_priv *priv) | |||
2269 | int rc = 0; | 3032 | int rc = 0; |
2270 | 3033 | ||
2271 | /* stop */ | 3034 | /* stop */ |
2272 | ipw_write32(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); | 3035 | ipw_write32(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); |
2273 | 3036 | ||
2274 | rc = ipw_poll_bit(priv, CX2_RESET_REG, | 3037 | rc = ipw_poll_bit(priv, IPW_RESET_REG, |
2275 | CX2_RESET_REG_MASTER_DISABLED, 500); | 3038 | IPW_RESET_REG_MASTER_DISABLED, 500); |
2276 | if (rc < 0) { | 3039 | if (rc < 0) { |
2277 | IPW_ERROR("wait for reg master disabled failed\n"); | 3040 | IPW_ERROR("wait for reg master disabled failed\n"); |
2278 | return rc; | 3041 | return rc; |
2279 | } | 3042 | } |
2280 | 3043 | ||
2281 | ipw_set_bit(priv, CX2_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); | 3044 | ipw_set_bit(priv, IPW_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); |
2282 | 3045 | ||
2283 | return rc; | 3046 | return rc; |
2284 | } | 3047 | } |
@@ -2288,14 +3051,14 @@ static void ipw_start_nic(struct ipw_priv *priv) | |||
2288 | IPW_DEBUG_TRACE(">>\n"); | 3051 | IPW_DEBUG_TRACE(">>\n"); |
2289 | 3052 | ||
2290 | /* prvHwStartNic release ARC */ | 3053 | /* prvHwStartNic release ARC */ |
2291 | ipw_clear_bit(priv, CX2_RESET_REG, | 3054 | ipw_clear_bit(priv, IPW_RESET_REG, |
2292 | CX2_RESET_REG_MASTER_DISABLED | | 3055 | IPW_RESET_REG_MASTER_DISABLED | |
2293 | CX2_RESET_REG_STOP_MASTER | | 3056 | IPW_RESET_REG_STOP_MASTER | |
2294 | CBD_RESET_REG_PRINCETON_RESET); | 3057 | CBD_RESET_REG_PRINCETON_RESET); |
2295 | 3058 | ||
2296 | /* enable power management */ | 3059 | /* enable power management */ |
2297 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, | 3060 | ipw_set_bit(priv, IPW_GP_CNTRL_RW, |
2298 | CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); | 3061 | IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); |
2299 | 3062 | ||
2300 | IPW_DEBUG_TRACE("<<\n"); | 3063 | IPW_DEBUG_TRACE("<<\n"); |
2301 | } | 3064 | } |
@@ -2308,25 +3071,25 @@ static int ipw_init_nic(struct ipw_priv *priv) | |||
2308 | /* reset */ | 3071 | /* reset */ |
2309 | /*prvHwInitNic */ | 3072 | /*prvHwInitNic */ |
2310 | /* set "initialization complete" bit to move adapter to D0 state */ | 3073 | /* set "initialization complete" bit to move adapter to D0 state */ |
2311 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); | 3074 | ipw_set_bit(priv, IPW_GP_CNTRL_RW, IPW_GP_CNTRL_BIT_INIT_DONE); |
2312 | 3075 | ||
2313 | /* low-level PLL activation */ | 3076 | /* low-level PLL activation */ |
2314 | ipw_write32(priv, CX2_READ_INT_REGISTER, | 3077 | ipw_write32(priv, IPW_READ_INT_REGISTER, |
2315 | CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER); | 3078 | IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER); |
2316 | 3079 | ||
2317 | /* wait for clock stabilization */ | 3080 | /* wait for clock stabilization */ |
2318 | rc = ipw_poll_bit(priv, CX2_GP_CNTRL_RW, | 3081 | rc = ipw_poll_bit(priv, IPW_GP_CNTRL_RW, |
2319 | CX2_GP_CNTRL_BIT_CLOCK_READY, 250); | 3082 | IPW_GP_CNTRL_BIT_CLOCK_READY, 250); |
2320 | if (rc < 0) | 3083 | if (rc < 0) |
2321 | IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); | 3084 | IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); |
2322 | 3085 | ||
2323 | /* assert SW reset */ | 3086 | /* assert SW reset */ |
2324 | ipw_set_bit(priv, CX2_RESET_REG, CX2_RESET_REG_SW_RESET); | 3087 | ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_SW_RESET); |
2325 | 3088 | ||
2326 | udelay(10); | 3089 | udelay(10); |
2327 | 3090 | ||
2328 | /* set "initialization complete" bit to move adapter to D0 state */ | 3091 | /* set "initialization complete" bit to move adapter to D0 state */ |
2329 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); | 3092 | ipw_set_bit(priv, IPW_GP_CNTRL_RW, IPW_GP_CNTRL_BIT_INIT_DONE); |
2330 | 3093 | ||
2331 | IPW_DEBUG_TRACE(">>\n"); | 3094 | IPW_DEBUG_TRACE(">>\n"); |
2332 | return 0; | 3095 | return 0; |
@@ -2338,14 +3101,19 @@ static int ipw_init_nic(struct ipw_priv *priv) | |||
2338 | static int ipw_reset_nic(struct ipw_priv *priv) | 3101 | static int ipw_reset_nic(struct ipw_priv *priv) |
2339 | { | 3102 | { |
2340 | int rc = 0; | 3103 | int rc = 0; |
3104 | unsigned long flags; | ||
2341 | 3105 | ||
2342 | IPW_DEBUG_TRACE(">>\n"); | 3106 | IPW_DEBUG_TRACE(">>\n"); |
2343 | 3107 | ||
2344 | rc = ipw_init_nic(priv); | 3108 | rc = ipw_init_nic(priv); |
2345 | 3109 | ||
3110 | spin_lock_irqsave(&priv->lock, flags); | ||
2346 | /* Clear the 'host command active' bit... */ | 3111 | /* Clear the 'host command active' bit... */ |
2347 | priv->status &= ~STATUS_HCMD_ACTIVE; | 3112 | priv->status &= ~STATUS_HCMD_ACTIVE; |
2348 | wake_up_interruptible(&priv->wait_command_queue); | 3113 | wake_up_interruptible(&priv->wait_command_queue); |
3114 | priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); | ||
3115 | wake_up_interruptible(&priv->wait_state); | ||
3116 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2349 | 3117 | ||
2350 | IPW_DEBUG_TRACE("<<\n"); | 3118 | IPW_DEBUG_TRACE("<<\n"); |
2351 | return rc; | 3119 | return rc; |
@@ -2365,22 +3133,23 @@ static int ipw_get_fw(struct ipw_priv *priv, | |||
2365 | } | 3133 | } |
2366 | 3134 | ||
2367 | header = (struct fw_header *)(*fw)->data; | 3135 | header = (struct fw_header *)(*fw)->data; |
2368 | if (IPW_FW_MAJOR(header->version) != IPW_FW_MAJOR_VERSION) { | 3136 | if (IPW_FW_MAJOR(le32_to_cpu(header->version)) != IPW_FW_MAJOR_VERSION) { |
2369 | IPW_ERROR("'%s' firmware version not compatible (%d != %d)\n", | 3137 | IPW_ERROR("'%s' firmware version not compatible (%d != %d)\n", |
2370 | name, | 3138 | name, |
2371 | IPW_FW_MAJOR(header->version), IPW_FW_MAJOR_VERSION); | 3139 | IPW_FW_MAJOR(le32_to_cpu(header->version)), |
3140 | IPW_FW_MAJOR_VERSION); | ||
2372 | return -EINVAL; | 3141 | return -EINVAL; |
2373 | } | 3142 | } |
2374 | 3143 | ||
2375 | IPW_DEBUG_INFO("Loading firmware '%s' file v%d.%d (%zd bytes)\n", | 3144 | IPW_DEBUG_INFO("Loading firmware '%s' file v%d.%d (%zd bytes)\n", |
2376 | name, | 3145 | name, |
2377 | IPW_FW_MAJOR(header->version), | 3146 | IPW_FW_MAJOR(le32_to_cpu(header->version)), |
2378 | IPW_FW_MINOR(header->version), | 3147 | IPW_FW_MINOR(le32_to_cpu(header->version)), |
2379 | (*fw)->size - sizeof(struct fw_header)); | 3148 | (*fw)->size - sizeof(struct fw_header)); |
2380 | return 0; | 3149 | return 0; |
2381 | } | 3150 | } |
2382 | 3151 | ||
2383 | #define CX2_RX_BUF_SIZE (3000) | 3152 | #define IPW_RX_BUF_SIZE (3000) |
2384 | 3153 | ||
2385 | static inline void ipw_rx_queue_reset(struct ipw_priv *priv, | 3154 | static inline void ipw_rx_queue_reset(struct ipw_priv *priv, |
2386 | struct ipw_rx_queue *rxq) | 3155 | struct ipw_rx_queue *rxq) |
@@ -2399,8 +3168,9 @@ static inline void ipw_rx_queue_reset(struct ipw_priv *priv, | |||
2399 | * to an SKB, so we need to unmap and free potential storage */ | 3168 | * to an SKB, so we need to unmap and free potential storage */ |
2400 | if (rxq->pool[i].skb != NULL) { | 3169 | if (rxq->pool[i].skb != NULL) { |
2401 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, | 3170 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, |
2402 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 3171 | IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
2403 | dev_kfree_skb(rxq->pool[i].skb); | 3172 | dev_kfree_skb(rxq->pool[i].skb); |
3173 | rxq->pool[i].skb = NULL; | ||
2404 | } | 3174 | } |
2405 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 3175 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
2406 | } | 3176 | } |
@@ -2418,6 +3188,19 @@ static int fw_loaded = 0; | |||
2418 | static const struct firmware *bootfw = NULL; | 3188 | static const struct firmware *bootfw = NULL; |
2419 | static const struct firmware *firmware = NULL; | 3189 | static const struct firmware *firmware = NULL; |
2420 | static const struct firmware *ucode = NULL; | 3190 | static const struct firmware *ucode = NULL; |
3191 | |||
3192 | static void free_firmware(void) | ||
3193 | { | ||
3194 | if (fw_loaded) { | ||
3195 | release_firmware(bootfw); | ||
3196 | release_firmware(ucode); | ||
3197 | release_firmware(firmware); | ||
3198 | bootfw = ucode = firmware = NULL; | ||
3199 | fw_loaded = 0; | ||
3200 | } | ||
3201 | } | ||
3202 | #else | ||
3203 | #define free_firmware() do {} while (0) | ||
2421 | #endif | 3204 | #endif |
2422 | 3205 | ||
2423 | static int ipw_load(struct ipw_priv *priv) | 3206 | static int ipw_load(struct ipw_priv *priv) |
@@ -2446,10 +3229,10 @@ static int ipw_load(struct ipw_priv *priv) | |||
2446 | rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss")); | 3229 | rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss")); |
2447 | break; | 3230 | break; |
2448 | 3231 | ||
2449 | #ifdef CONFIG_IPW_PROMISC | 3232 | #ifdef CONFIG_IPW2200_MONITOR |
2450 | case IW_MODE_MONITOR: | 3233 | case IW_MODE_MONITOR: |
2451 | rc = ipw_get_fw(priv, &ucode, | 3234 | rc = ipw_get_fw(priv, &ucode, |
2452 | IPW_FW_NAME("ibss_ucode")); | 3235 | IPW_FW_NAME("sniffer_ucode")); |
2453 | if (rc) | 3236 | if (rc) |
2454 | goto error; | 3237 | goto error; |
2455 | 3238 | ||
@@ -2488,11 +3271,11 @@ static int ipw_load(struct ipw_priv *priv) | |||
2488 | 3271 | ||
2489 | retry: | 3272 | retry: |
2490 | /* Ensure interrupts are disabled */ | 3273 | /* Ensure interrupts are disabled */ |
2491 | ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); | 3274 | ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); |
2492 | priv->status &= ~STATUS_INT_ENABLED; | 3275 | priv->status &= ~STATUS_INT_ENABLED; |
2493 | 3276 | ||
2494 | /* ack pending interrupts */ | 3277 | /* ack pending interrupts */ |
2495 | ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); | 3278 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); |
2496 | 3279 | ||
2497 | ipw_stop_nic(priv); | 3280 | ipw_stop_nic(priv); |
2498 | 3281 | ||
@@ -2502,14 +3285,14 @@ static int ipw_load(struct ipw_priv *priv) | |||
2502 | goto error; | 3285 | goto error; |
2503 | } | 3286 | } |
2504 | 3287 | ||
2505 | ipw_zero_memory(priv, CX2_NIC_SRAM_LOWER_BOUND, | 3288 | ipw_zero_memory(priv, IPW_NIC_SRAM_LOWER_BOUND, |
2506 | CX2_NIC_SRAM_UPPER_BOUND - CX2_NIC_SRAM_LOWER_BOUND); | 3289 | IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); |
2507 | 3290 | ||
2508 | /* DMA the initial boot firmware into the device */ | 3291 | /* DMA the initial boot firmware into the device */ |
2509 | rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), | 3292 | rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), |
2510 | bootfw->size - sizeof(struct fw_header)); | 3293 | bootfw->size - sizeof(struct fw_header)); |
2511 | if (rc < 0) { | 3294 | if (rc < 0) { |
2512 | IPW_ERROR("Unable to load boot firmware\n"); | 3295 | IPW_ERROR("Unable to load boot firmware: %d\n", rc); |
2513 | goto error; | 3296 | goto error; |
2514 | } | 3297 | } |
2515 | 3298 | ||
@@ -2517,8 +3300,8 @@ static int ipw_load(struct ipw_priv *priv) | |||
2517 | ipw_start_nic(priv); | 3300 | ipw_start_nic(priv); |
2518 | 3301 | ||
2519 | /* wait for the device to finish it's initial startup sequence */ | 3302 | /* wait for the device to finish it's initial startup sequence */ |
2520 | rc = ipw_poll_bit(priv, CX2_INTA_RW, | 3303 | rc = ipw_poll_bit(priv, IPW_INTA_RW, |
2521 | CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500); | 3304 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); |
2522 | if (rc < 0) { | 3305 | if (rc < 0) { |
2523 | IPW_ERROR("device failed to boot initial fw image\n"); | 3306 | IPW_ERROR("device failed to boot initial fw image\n"); |
2524 | goto error; | 3307 | goto error; |
@@ -2526,13 +3309,13 @@ static int ipw_load(struct ipw_priv *priv) | |||
2526 | IPW_DEBUG_INFO("initial device response after %dms\n", rc); | 3309 | IPW_DEBUG_INFO("initial device response after %dms\n", rc); |
2527 | 3310 | ||
2528 | /* ack fw init done interrupt */ | 3311 | /* ack fw init done interrupt */ |
2529 | ipw_write32(priv, CX2_INTA_RW, CX2_INTA_BIT_FW_INITIALIZATION_DONE); | 3312 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); |
2530 | 3313 | ||
2531 | /* DMA the ucode into the device */ | 3314 | /* DMA the ucode into the device */ |
2532 | rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), | 3315 | rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), |
2533 | ucode->size - sizeof(struct fw_header)); | 3316 | ucode->size - sizeof(struct fw_header)); |
2534 | if (rc < 0) { | 3317 | if (rc < 0) { |
2535 | IPW_ERROR("Unable to load ucode\n"); | 3318 | IPW_ERROR("Unable to load ucode: %d\n", rc); |
2536 | goto error; | 3319 | goto error; |
2537 | } | 3320 | } |
2538 | 3321 | ||
@@ -2544,7 +3327,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
2544 | sizeof(struct fw_header), | 3327 | sizeof(struct fw_header), |
2545 | firmware->size - sizeof(struct fw_header)); | 3328 | firmware->size - sizeof(struct fw_header)); |
2546 | if (rc < 0) { | 3329 | if (rc < 0) { |
2547 | IPW_ERROR("Unable to load firmware\n"); | 3330 | IPW_ERROR("Unable to load firmware: %d\n", rc); |
2548 | goto error; | 3331 | goto error; |
2549 | } | 3332 | } |
2550 | 3333 | ||
@@ -2557,12 +3340,14 @@ static int ipw_load(struct ipw_priv *priv) | |||
2557 | } | 3340 | } |
2558 | 3341 | ||
2559 | /* Ensure interrupts are disabled */ | 3342 | /* Ensure interrupts are disabled */ |
2560 | ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); | 3343 | ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); |
3344 | /* ack pending interrupts */ | ||
3345 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); | ||
2561 | 3346 | ||
2562 | /* kick start the device */ | 3347 | /* kick start the device */ |
2563 | ipw_start_nic(priv); | 3348 | ipw_start_nic(priv); |
2564 | 3349 | ||
2565 | if (ipw_read32(priv, CX2_INTA_RW) & CX2_INTA_BIT_PARITY_ERROR) { | 3350 | if (ipw_read32(priv, IPW_INTA_RW) & IPW_INTA_BIT_PARITY_ERROR) { |
2566 | if (retries > 0) { | 3351 | if (retries > 0) { |
2567 | IPW_WARNING("Parity error. Retrying init.\n"); | 3352 | IPW_WARNING("Parity error. Retrying init.\n"); |
2568 | retries--; | 3353 | retries--; |
@@ -2575,8 +3360,8 @@ static int ipw_load(struct ipw_priv *priv) | |||
2575 | } | 3360 | } |
2576 | 3361 | ||
2577 | /* wait for the device */ | 3362 | /* wait for the device */ |
2578 | rc = ipw_poll_bit(priv, CX2_INTA_RW, | 3363 | rc = ipw_poll_bit(priv, IPW_INTA_RW, |
2579 | CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500); | 3364 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); |
2580 | if (rc < 0) { | 3365 | if (rc < 0) { |
2581 | IPW_ERROR("device failed to start after 500ms\n"); | 3366 | IPW_ERROR("device failed to start after 500ms\n"); |
2582 | goto error; | 3367 | goto error; |
@@ -2584,7 +3369,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
2584 | IPW_DEBUG_INFO("device response after %dms\n", rc); | 3369 | IPW_DEBUG_INFO("device response after %dms\n", rc); |
2585 | 3370 | ||
2586 | /* ack fw init done interrupt */ | 3371 | /* ack fw init done interrupt */ |
2587 | ipw_write32(priv, CX2_INTA_RW, CX2_INTA_BIT_FW_INITIALIZATION_DONE); | 3372 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); |
2588 | 3373 | ||
2589 | /* read eeprom data and initialize the eeprom region of sram */ | 3374 | /* read eeprom data and initialize the eeprom region of sram */ |
2590 | priv->eeprom_delay = 1; | 3375 | priv->eeprom_delay = 1; |
@@ -2596,10 +3381,10 @@ static int ipw_load(struct ipw_priv *priv) | |||
2596 | /* Ensure our queue has valid packets */ | 3381 | /* Ensure our queue has valid packets */ |
2597 | ipw_rx_queue_replenish(priv); | 3382 | ipw_rx_queue_replenish(priv); |
2598 | 3383 | ||
2599 | ipw_write32(priv, CX2_RX_READ_INDEX, priv->rxq->read); | 3384 | ipw_write32(priv, IPW_RX_READ_INDEX, priv->rxq->read); |
2600 | 3385 | ||
2601 | /* ack pending interrupts */ | 3386 | /* ack pending interrupts */ |
2602 | ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); | 3387 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); |
2603 | 3388 | ||
2604 | #ifndef CONFIG_PM | 3389 | #ifndef CONFIG_PM |
2605 | release_firmware(bootfw); | 3390 | release_firmware(bootfw); |
@@ -2756,16 +3541,18 @@ static void ipw_queue_tx_free_tfd(struct ipw_priv *priv, | |||
2756 | return; | 3541 | return; |
2757 | 3542 | ||
2758 | /* sanity check */ | 3543 | /* sanity check */ |
2759 | if (bd->u.data.num_chunks > NUM_TFD_CHUNKS) { | 3544 | if (le32_to_cpu(bd->u.data.num_chunks) > NUM_TFD_CHUNKS) { |
2760 | IPW_ERROR("Too many chunks: %i\n", bd->u.data.num_chunks); | 3545 | IPW_ERROR("Too many chunks: %i\n", |
3546 | le32_to_cpu(bd->u.data.num_chunks)); | ||
2761 | /** @todo issue fatal error, it is quite serious situation */ | 3547 | /** @todo issue fatal error, it is quite serious situation */ |
2762 | return; | 3548 | return; |
2763 | } | 3549 | } |
2764 | 3550 | ||
2765 | /* unmap chunks if any */ | 3551 | /* unmap chunks if any */ |
2766 | for (i = 0; i < bd->u.data.num_chunks; i++) { | 3552 | for (i = 0; i < le32_to_cpu(bd->u.data.num_chunks); i++) { |
2767 | pci_unmap_single(dev, bd->u.data.chunk_ptr[i], | 3553 | pci_unmap_single(dev, le32_to_cpu(bd->u.data.chunk_ptr[i]), |
2768 | bd->u.data.chunk_len[i], PCI_DMA_TODEVICE); | 3554 | le16_to_cpu(bd->u.data.chunk_len[i]), |
3555 | PCI_DMA_TODEVICE); | ||
2769 | if (txq->txb[txq->q.last_used]) { | 3556 | if (txq->txb[txq->q.last_used]) { |
2770 | ieee80211_txb_free(txq->txb[txq->q.last_used]); | 3557 | ieee80211_txb_free(txq->txb[txq->q.last_used]); |
2771 | txq->txb[txq->q.last_used] = NULL; | 3558 | txq->txb[txq->q.last_used] = NULL; |
@@ -2822,21 +3609,6 @@ static void ipw_tx_queue_free(struct ipw_priv *priv) | |||
2822 | ipw_queue_tx_free(priv, &priv->txq[3]); | 3609 | ipw_queue_tx_free(priv, &priv->txq[3]); |
2823 | } | 3610 | } |
2824 | 3611 | ||
2825 | static void inline __maybe_wake_tx(struct ipw_priv *priv) | ||
2826 | { | ||
2827 | if (netif_running(priv->net_dev)) { | ||
2828 | switch (priv->port_type) { | ||
2829 | case DCR_TYPE_MU_BSS: | ||
2830 | case DCR_TYPE_MU_IBSS: | ||
2831 | if (!(priv->status & STATUS_ASSOCIATED)) { | ||
2832 | return; | ||
2833 | } | ||
2834 | } | ||
2835 | netif_wake_queue(priv->net_dev); | ||
2836 | } | ||
2837 | |||
2838 | } | ||
2839 | |||
2840 | static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) | 3612 | static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) |
2841 | { | 3613 | { |
2842 | /* First 3 bytes are manufacturer */ | 3614 | /* First 3 bytes are manufacturer */ |
@@ -2899,7 +3671,13 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) | |||
2899 | { | 3671 | { |
2900 | int err; | 3672 | int err; |
2901 | 3673 | ||
2902 | if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED))) { | 3674 | if (priv->status & STATUS_ASSOCIATING) { |
3675 | IPW_DEBUG_ASSOC("Disassociating while associating.\n"); | ||
3676 | queue_work(priv->workqueue, &priv->disassociate); | ||
3677 | return; | ||
3678 | } | ||
3679 | |||
3680 | if (!(priv->status & STATUS_ASSOCIATED)) { | ||
2903 | IPW_DEBUG_ASSOC("Disassociating while not associated.\n"); | 3681 | IPW_DEBUG_ASSOC("Disassociating while not associated.\n"); |
2904 | return; | 3682 | return; |
2905 | } | 3683 | } |
@@ -2916,6 +3694,7 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) | |||
2916 | priv->assoc_request.assoc_type = HC_DISASSOC_QUIET; | 3694 | priv->assoc_request.assoc_type = HC_DISASSOC_QUIET; |
2917 | else | 3695 | else |
2918 | priv->assoc_request.assoc_type = HC_DISASSOCIATE; | 3696 | priv->assoc_request.assoc_type = HC_DISASSOCIATE; |
3697 | |||
2919 | err = ipw_send_associate(priv, &priv->assoc_request); | 3698 | err = ipw_send_associate(priv, &priv->assoc_request); |
2920 | if (err) { | 3699 | if (err) { |
2921 | IPW_DEBUG_HC("Attempt to send [dis]associate command " | 3700 | IPW_DEBUG_HC("Attempt to send [dis]associate command " |
@@ -2925,20 +3704,27 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) | |||
2925 | 3704 | ||
2926 | } | 3705 | } |
2927 | 3706 | ||
2928 | static void ipw_disassociate(void *data) | 3707 | static int ipw_disassociate(void *data) |
2929 | { | 3708 | { |
3709 | struct ipw_priv *priv = data; | ||
3710 | if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) | ||
3711 | return 0; | ||
2930 | ipw_send_disassociate(data, 0); | 3712 | ipw_send_disassociate(data, 0); |
3713 | return 1; | ||
2931 | } | 3714 | } |
2932 | 3715 | ||
2933 | static void notify_wx_assoc_event(struct ipw_priv *priv) | 3716 | static void ipw_bg_disassociate(void *data) |
2934 | { | 3717 | { |
2935 | union iwreq_data wrqu; | 3718 | struct ipw_priv *priv = data; |
2936 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 3719 | down(&priv->sem); |
2937 | if (priv->status & STATUS_ASSOCIATED) | 3720 | ipw_disassociate(data); |
2938 | memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); | 3721 | up(&priv->sem); |
2939 | else | 3722 | } |
2940 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); | 3723 | |
2941 | wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); | 3724 | static void ipw_system_config(void *data) |
3725 | { | ||
3726 | struct ipw_priv *priv = data; | ||
3727 | ipw_send_system_config(priv, &priv->sys_config); | ||
2942 | } | 3728 | } |
2943 | 3729 | ||
2944 | struct ipw_status_code { | 3730 | struct ipw_status_code { |
@@ -2998,7 +3784,7 @@ static const char *ipw_get_status_code(u16 status) | |||
2998 | { | 3784 | { |
2999 | int i; | 3785 | int i; |
3000 | for (i = 0; i < ARRAY_SIZE(ipw_status_codes); i++) | 3786 | for (i = 0; i < ARRAY_SIZE(ipw_status_codes); i++) |
3001 | if (ipw_status_codes[i].status == status) | 3787 | if (ipw_status_codes[i].status == (status & 0xff)) |
3002 | return ipw_status_codes[i].reason; | 3788 | return ipw_status_codes[i].reason; |
3003 | return "Unknown status value."; | 3789 | return "Unknown status value."; |
3004 | } | 3790 | } |
@@ -3077,18 +3863,30 @@ static inline u32 ipw_get_max_rate(struct ipw_priv *priv) | |||
3077 | while (i && !(mask & i)) | 3863 | while (i && !(mask & i)) |
3078 | i >>= 1; | 3864 | i >>= 1; |
3079 | switch (i) { | 3865 | switch (i) { |
3080 | case IEEE80211_CCK_RATE_1MB_MASK: return 1000000; | 3866 | case IEEE80211_CCK_RATE_1MB_MASK: |
3081 | case IEEE80211_CCK_RATE_2MB_MASK: return 2000000; | 3867 | return 1000000; |
3082 | case IEEE80211_CCK_RATE_5MB_MASK: return 5500000; | 3868 | case IEEE80211_CCK_RATE_2MB_MASK: |
3083 | case IEEE80211_OFDM_RATE_6MB_MASK: return 6000000; | 3869 | return 2000000; |
3084 | case IEEE80211_OFDM_RATE_9MB_MASK: return 9000000; | 3870 | case IEEE80211_CCK_RATE_5MB_MASK: |
3085 | case IEEE80211_CCK_RATE_11MB_MASK: return 11000000; | 3871 | return 5500000; |
3086 | case IEEE80211_OFDM_RATE_12MB_MASK: return 12000000; | 3872 | case IEEE80211_OFDM_RATE_6MB_MASK: |
3087 | case IEEE80211_OFDM_RATE_18MB_MASK: return 18000000; | 3873 | return 6000000; |
3088 | case IEEE80211_OFDM_RATE_24MB_MASK: return 24000000; | 3874 | case IEEE80211_OFDM_RATE_9MB_MASK: |
3089 | case IEEE80211_OFDM_RATE_36MB_MASK: return 36000000; | 3875 | return 9000000; |
3090 | case IEEE80211_OFDM_RATE_48MB_MASK: return 48000000; | 3876 | case IEEE80211_CCK_RATE_11MB_MASK: |
3091 | case IEEE80211_OFDM_RATE_54MB_MASK: return 54000000; | 3877 | return 11000000; |
3878 | case IEEE80211_OFDM_RATE_12MB_MASK: | ||
3879 | return 12000000; | ||
3880 | case IEEE80211_OFDM_RATE_18MB_MASK: | ||
3881 | return 18000000; | ||
3882 | case IEEE80211_OFDM_RATE_24MB_MASK: | ||
3883 | return 24000000; | ||
3884 | case IEEE80211_OFDM_RATE_36MB_MASK: | ||
3885 | return 36000000; | ||
3886 | case IEEE80211_OFDM_RATE_48MB_MASK: | ||
3887 | return 48000000; | ||
3888 | case IEEE80211_OFDM_RATE_54MB_MASK: | ||
3889 | return 54000000; | ||
3092 | } | 3890 | } |
3093 | 3891 | ||
3094 | if (priv->ieee->mode == IEEE_B) | 3892 | if (priv->ieee->mode == IEEE_B) |
@@ -3116,25 +3914,35 @@ static u32 ipw_get_current_rate(struct ipw_priv *priv) | |||
3116 | return ipw_get_max_rate(priv); | 3914 | return ipw_get_max_rate(priv); |
3117 | 3915 | ||
3118 | switch (rate) { | 3916 | switch (rate) { |
3119 | case IPW_TX_RATE_1MB: return 1000000; | 3917 | case IPW_TX_RATE_1MB: |
3120 | case IPW_TX_RATE_2MB: return 2000000; | 3918 | return 1000000; |
3121 | case IPW_TX_RATE_5MB: return 5500000; | 3919 | case IPW_TX_RATE_2MB: |
3122 | case IPW_TX_RATE_6MB: return 6000000; | 3920 | return 2000000; |
3123 | case IPW_TX_RATE_9MB: return 9000000; | 3921 | case IPW_TX_RATE_5MB: |
3124 | case IPW_TX_RATE_11MB: return 11000000; | 3922 | return 5500000; |
3125 | case IPW_TX_RATE_12MB: return 12000000; | 3923 | case IPW_TX_RATE_6MB: |
3126 | case IPW_TX_RATE_18MB: return 18000000; | 3924 | return 6000000; |
3127 | case IPW_TX_RATE_24MB: return 24000000; | 3925 | case IPW_TX_RATE_9MB: |
3128 | case IPW_TX_RATE_36MB: return 36000000; | 3926 | return 9000000; |
3129 | case IPW_TX_RATE_48MB: return 48000000; | 3927 | case IPW_TX_RATE_11MB: |
3130 | case IPW_TX_RATE_54MB: return 54000000; | 3928 | return 11000000; |
3929 | case IPW_TX_RATE_12MB: | ||
3930 | return 12000000; | ||
3931 | case IPW_TX_RATE_18MB: | ||
3932 | return 18000000; | ||
3933 | case IPW_TX_RATE_24MB: | ||
3934 | return 24000000; | ||
3935 | case IPW_TX_RATE_36MB: | ||
3936 | return 36000000; | ||
3937 | case IPW_TX_RATE_48MB: | ||
3938 | return 48000000; | ||
3939 | case IPW_TX_RATE_54MB: | ||
3940 | return 54000000; | ||
3131 | } | 3941 | } |
3132 | 3942 | ||
3133 | return 0; | 3943 | return 0; |
3134 | } | 3944 | } |
3135 | 3945 | ||
3136 | #define PERFECT_RSSI (-50) | ||
3137 | #define WORST_RSSI (-85) | ||
3138 | #define IPW_STATS_INTERVAL (2 * HZ) | 3946 | #define IPW_STATS_INTERVAL (2 * HZ) |
3139 | static void ipw_gather_stats(struct ipw_priv *priv) | 3947 | static void ipw_gather_stats(struct ipw_priv *priv) |
3140 | { | 3948 | { |
@@ -3146,6 +3954,7 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3146 | s16 rssi; | 3954 | s16 rssi; |
3147 | u32 beacon_quality, signal_quality, tx_quality, rx_quality, | 3955 | u32 beacon_quality, signal_quality, tx_quality, rx_quality, |
3148 | rate_quality; | 3956 | rate_quality; |
3957 | u32 max_rate; | ||
3149 | 3958 | ||
3150 | if (!(priv->status & STATUS_ASSOCIATED)) { | 3959 | if (!(priv->status & STATUS_ASSOCIATED)) { |
3151 | priv->quality = 0; | 3960 | priv->quality = 0; |
@@ -3202,7 +4011,8 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3202 | beacon_quality, missed_beacons_percent); | 4011 | beacon_quality, missed_beacons_percent); |
3203 | 4012 | ||
3204 | priv->last_rate = ipw_get_current_rate(priv); | 4013 | priv->last_rate = ipw_get_current_rate(priv); |
3205 | rate_quality = priv->last_rate * 40 / priv->last_rate + 60; | 4014 | max_rate = ipw_get_max_rate(priv); |
4015 | rate_quality = priv->last_rate * 40 / max_rate + 60; | ||
3206 | IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", | 4016 | IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", |
3207 | rate_quality, priv->last_rate / 1000000); | 4017 | rate_quality, priv->last_rate / 1000000); |
3208 | 4018 | ||
@@ -3223,13 +4033,20 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3223 | tx_quality, tx_failures_delta, tx_packets_delta); | 4033 | tx_quality, tx_failures_delta, tx_packets_delta); |
3224 | 4034 | ||
3225 | rssi = average_value(&priv->average_rssi); | 4035 | rssi = average_value(&priv->average_rssi); |
3226 | if (rssi > PERFECT_RSSI) | 4036 | signal_quality = |
4037 | (100 * | ||
4038 | (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) * | ||
4039 | (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) - | ||
4040 | (priv->ieee->perfect_rssi - rssi) * | ||
4041 | (15 * (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) + | ||
4042 | 62 * (priv->ieee->perfect_rssi - rssi))) / | ||
4043 | ((priv->ieee->perfect_rssi - priv->ieee->worst_rssi) * | ||
4044 | (priv->ieee->perfect_rssi - priv->ieee->worst_rssi)); | ||
4045 | if (signal_quality > 100) | ||
3227 | signal_quality = 100; | 4046 | signal_quality = 100; |
3228 | else if (rssi < WORST_RSSI) | 4047 | else if (signal_quality < 1) |
3229 | signal_quality = 0; | 4048 | signal_quality = 0; |
3230 | else | 4049 | |
3231 | signal_quality = (rssi - WORST_RSSI) * 100 / | ||
3232 | (PERFECT_RSSI - WORST_RSSI); | ||
3233 | IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", | 4050 | IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", |
3234 | signal_quality, rssi); | 4051 | signal_quality, rssi); |
3235 | 4052 | ||
@@ -3258,6 +4075,85 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3258 | IPW_STATS_INTERVAL); | 4075 | IPW_STATS_INTERVAL); |
3259 | } | 4076 | } |
3260 | 4077 | ||
4078 | static void ipw_bg_gather_stats(void *data) | ||
4079 | { | ||
4080 | struct ipw_priv *priv = data; | ||
4081 | down(&priv->sem); | ||
4082 | ipw_gather_stats(data); | ||
4083 | up(&priv->sem); | ||
4084 | } | ||
4085 | |||
4086 | /* Missed beacon behavior: | ||
4087 | * 1st missed -> roaming_threshold, just wait, don't do any scan/roam. | ||
4088 | * roaming_threshold -> disassociate_threshold, scan and roam for better signal. | ||
4089 | * Above disassociate threshold, give up and stop scanning. | ||
4090 | * Roaming is disabled if disassociate_threshold <= roaming_threshold */ | ||
4091 | static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, | ||
4092 | int missed_count) | ||
4093 | { | ||
4094 | priv->notif_missed_beacons = missed_count; | ||
4095 | |||
4096 | if (missed_count > priv->disassociate_threshold && | ||
4097 | priv->status & STATUS_ASSOCIATED) { | ||
4098 | /* If associated and we've hit the missed | ||
4099 | * beacon threshold, disassociate, turn | ||
4100 | * off roaming, and abort any active scans */ | ||
4101 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | | ||
4102 | IPW_DL_STATE | IPW_DL_ASSOC, | ||
4103 | "Missed beacon: %d - disassociate\n", missed_count); | ||
4104 | priv->status &= ~STATUS_ROAMING; | ||
4105 | if (priv->status & STATUS_SCANNING) { | ||
4106 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | | ||
4107 | IPW_DL_STATE, | ||
4108 | "Aborting scan with missed beacon.\n"); | ||
4109 | queue_work(priv->workqueue, &priv->abort_scan); | ||
4110 | } | ||
4111 | |||
4112 | queue_work(priv->workqueue, &priv->disassociate); | ||
4113 | return; | ||
4114 | } | ||
4115 | |||
4116 | if (priv->status & STATUS_ROAMING) { | ||
4117 | /* If we are currently roaming, then just | ||
4118 | * print a debug statement... */ | ||
4119 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
4120 | "Missed beacon: %d - roam in progress\n", | ||
4121 | missed_count); | ||
4122 | return; | ||
4123 | } | ||
4124 | |||
4125 | if (missed_count > priv->roaming_threshold && | ||
4126 | missed_count <= priv->disassociate_threshold) { | ||
4127 | /* If we are not already roaming, set the ROAM | ||
4128 | * bit in the status and kick off a scan. | ||
4129 | * This can happen several times before we reach | ||
4130 | * disassociate_threshold. */ | ||
4131 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
4132 | "Missed beacon: %d - initiate " | ||
4133 | "roaming\n", missed_count); | ||
4134 | if (!(priv->status & STATUS_ROAMING)) { | ||
4135 | priv->status |= STATUS_ROAMING; | ||
4136 | if (!(priv->status & STATUS_SCANNING)) | ||
4137 | queue_work(priv->workqueue, | ||
4138 | &priv->request_scan); | ||
4139 | } | ||
4140 | return; | ||
4141 | } | ||
4142 | |||
4143 | if (priv->status & STATUS_SCANNING) { | ||
4144 | /* Stop scan to keep fw from getting | ||
4145 | * stuck (only if we aren't roaming -- | ||
4146 | * otherwise we'll never scan more than 2 or 3 | ||
4147 | * channels..) */ | ||
4148 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | IPW_DL_STATE, | ||
4149 | "Aborting scan with missed beacon.\n"); | ||
4150 | queue_work(priv->workqueue, &priv->abort_scan); | ||
4151 | } | ||
4152 | |||
4153 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); | ||
4154 | |||
4155 | } | ||
4156 | |||
3261 | /** | 4157 | /** |
3262 | * Handle host notification packet. | 4158 | * Handle host notification packet. |
3263 | * Called from interrupt routine | 4159 | * Called from interrupt routine |
@@ -3265,6 +4161,8 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3265 | static inline void ipw_rx_notification(struct ipw_priv *priv, | 4161 | static inline void ipw_rx_notification(struct ipw_priv *priv, |
3266 | struct ipw_rx_notification *notif) | 4162 | struct ipw_rx_notification *notif) |
3267 | { | 4163 | { |
4164 | notif->size = le16_to_cpu(notif->size); | ||
4165 | |||
3268 | IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, notif->size); | 4166 | IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, notif->size); |
3269 | 4167 | ||
3270 | switch (notif->subtype) { | 4168 | switch (notif->subtype) { |
@@ -3308,30 +4206,44 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3308 | 4206 | ||
3309 | priv->status &= ~STATUS_ASSOCIATING; | 4207 | priv->status &= ~STATUS_ASSOCIATING; |
3310 | priv->status |= STATUS_ASSOCIATED; | 4208 | priv->status |= STATUS_ASSOCIATED; |
3311 | 4209 | queue_work(priv->workqueue, | |
3312 | netif_carrier_on(priv->net_dev); | 4210 | &priv->system_config); |
3313 | if (netif_queue_stopped(priv->net_dev)) { | 4211 | |
3314 | IPW_DEBUG_NOTIF | 4212 | #ifdef CONFIG_IPW_QOS |
3315 | ("waking queue\n"); | 4213 | #define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \ |
3316 | netif_wake_queue(priv->net_dev); | 4214 | le16_to_cpu(((struct ieee80211_hdr *)(x))->frame_ctl)) |
3317 | } else { | 4215 | if ((priv->status & STATUS_AUTH) && |
3318 | IPW_DEBUG_NOTIF | 4216 | (IPW_GET_PACKET_STYPE(¬if->u.raw) |
3319 | ("starting queue\n"); | 4217 | == IEEE80211_STYPE_ASSOC_RESP)) { |
3320 | netif_start_queue(priv-> | 4218 | if ((sizeof |
3321 | net_dev); | 4219 | (struct |
4220 | ieee80211_assoc_response) | ||
4221 | <= notif->size) | ||
4222 | && (notif->size <= 2314)) { | ||
4223 | struct | ||
4224 | ieee80211_rx_stats | ||
4225 | stats = { | ||
4226 | .len = | ||
4227 | notif-> | ||
4228 | size - 1, | ||
4229 | }; | ||
4230 | |||
4231 | IPW_DEBUG_QOS | ||
4232 | ("QoS Associate " | ||
4233 | "size %d\n", | ||
4234 | notif->size); | ||
4235 | ieee80211_rx_mgt(priv-> | ||
4236 | ieee, | ||
4237 | (struct | ||
4238 | ieee80211_hdr_4addr | ||
4239 | *) | ||
4240 | ¬if->u.raw, &stats); | ||
4241 | } | ||
3322 | } | 4242 | } |
4243 | #endif | ||
3323 | 4244 | ||
3324 | ipw_reset_stats(priv); | 4245 | schedule_work(&priv->link_up); |
3325 | /* Ensure the rate is updated immediately */ | ||
3326 | priv->last_rate = | ||
3327 | ipw_get_current_rate(priv); | ||
3328 | schedule_work(&priv->gather_stats); | ||
3329 | notify_wx_assoc_event(priv); | ||
3330 | 4246 | ||
3331 | /* queue_delayed_work(priv->workqueue, | ||
3332 | &priv->request_scan, | ||
3333 | SCAN_ASSOCIATED_INTERVAL); | ||
3334 | */ | ||
3335 | break; | 4247 | break; |
3336 | } | 4248 | } |
3337 | 4249 | ||
@@ -3364,12 +4276,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3364 | STATUS_AUTH | | 4276 | STATUS_AUTH | |
3365 | STATUS_ASSOCIATED); | 4277 | STATUS_ASSOCIATED); |
3366 | 4278 | ||
3367 | netif_carrier_off(priv-> | 4279 | schedule_work(&priv->link_down); |
3368 | net_dev); | ||
3369 | netif_stop_queue(priv->net_dev); | ||
3370 | queue_work(priv->workqueue, | ||
3371 | &priv->request_scan); | ||
3372 | notify_wx_assoc_event(priv); | ||
3373 | break; | 4280 | break; |
3374 | } | 4281 | } |
3375 | 4282 | ||
@@ -3384,6 +4291,24 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3384 | } | 4291 | } |
3385 | 4292 | ||
3386 | case CMAS_INIT:{ | 4293 | case CMAS_INIT:{ |
4294 | if (priv->status & STATUS_AUTH) { | ||
4295 | struct | ||
4296 | ieee80211_assoc_response | ||
4297 | *resp; | ||
4298 | resp = | ||
4299 | (struct | ||
4300 | ieee80211_assoc_response | ||
4301 | *)¬if->u.raw; | ||
4302 | IPW_DEBUG(IPW_DL_NOTIF | | ||
4303 | IPW_DL_STATE | | ||
4304 | IPW_DL_ASSOC, | ||
4305 | "association failed (0x%04X): %s\n", | ||
4306 | ntohs(resp->status), | ||
4307 | ipw_get_status_code | ||
4308 | (ntohs | ||
4309 | (resp->status))); | ||
4310 | } | ||
4311 | |||
3387 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | 4312 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
3388 | IPW_DL_ASSOC, | 4313 | IPW_DL_ASSOC, |
3389 | "disassociated: '%s' " MAC_FMT | 4314 | "disassociated: '%s' " MAC_FMT |
@@ -3396,35 +4321,21 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3396 | ~(STATUS_DISASSOCIATING | | 4321 | ~(STATUS_DISASSOCIATING | |
3397 | STATUS_ASSOCIATING | | 4322 | STATUS_ASSOCIATING | |
3398 | STATUS_ASSOCIATED | STATUS_AUTH); | 4323 | STATUS_ASSOCIATED | STATUS_AUTH); |
4324 | if (priv->assoc_network | ||
4325 | && (priv->assoc_network-> | ||
4326 | capability & | ||
4327 | WLAN_CAPABILITY_IBSS)) | ||
4328 | ipw_remove_current_network | ||
4329 | (priv); | ||
3399 | 4330 | ||
3400 | netif_stop_queue(priv->net_dev); | 4331 | schedule_work(&priv->link_down); |
3401 | if (!(priv->status & STATUS_ROAMING)) { | ||
3402 | netif_carrier_off(priv-> | ||
3403 | net_dev); | ||
3404 | notify_wx_assoc_event(priv); | ||
3405 | |||
3406 | /* Cancel any queued work ... */ | ||
3407 | cancel_delayed_work(&priv-> | ||
3408 | request_scan); | ||
3409 | cancel_delayed_work(&priv-> | ||
3410 | adhoc_check); | ||
3411 | |||
3412 | /* Queue up another scan... */ | ||
3413 | queue_work(priv->workqueue, | ||
3414 | &priv->request_scan); | ||
3415 | |||
3416 | cancel_delayed_work(&priv-> | ||
3417 | gather_stats); | ||
3418 | } else { | ||
3419 | priv->status |= STATUS_ROAMING; | ||
3420 | queue_work(priv->workqueue, | ||
3421 | &priv->request_scan); | ||
3422 | } | ||
3423 | 4332 | ||
3424 | ipw_reset_stats(priv); | ||
3425 | break; | 4333 | break; |
3426 | } | 4334 | } |
3427 | 4335 | ||
4336 | case CMAS_RX_ASSOC_RESP: | ||
4337 | break; | ||
4338 | |||
3428 | default: | 4339 | default: |
3429 | IPW_ERROR("assoc: unknown (%d)\n", | 4340 | IPW_ERROR("assoc: unknown (%d)\n", |
3430 | assoc->state); | 4341 | assoc->state); |
@@ -3467,11 +4378,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3467 | STATUS_AUTH | | 4378 | STATUS_AUTH | |
3468 | STATUS_ASSOCIATED); | 4379 | STATUS_ASSOCIATED); |
3469 | 4380 | ||
3470 | netif_carrier_off(priv->net_dev); | 4381 | schedule_work(&priv->link_down); |
3471 | netif_stop_queue(priv->net_dev); | ||
3472 | queue_work(priv->workqueue, | ||
3473 | &priv->request_scan); | ||
3474 | notify_wx_assoc_event(priv); | ||
3475 | break; | 4382 | break; |
3476 | 4383 | ||
3477 | case CMAS_TX_AUTH_SEQ_1: | 4384 | case CMAS_TX_AUTH_SEQ_1: |
@@ -3513,6 +4420,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3513 | case CMAS_RX_ASSOC_RESP: | 4420 | case CMAS_RX_ASSOC_RESP: |
3514 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | 4421 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
3515 | IPW_DL_ASSOC, "RX_ASSOC_RESP\n"); | 4422 | IPW_DL_ASSOC, "RX_ASSOC_RESP\n"); |
4423 | |||
3516 | break; | 4424 | break; |
3517 | case CMAS_ASSOCIATED: | 4425 | case CMAS_ASSOCIATED: |
3518 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | 4426 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
@@ -3557,43 +4465,67 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3557 | priv->status &= | 4465 | priv->status &= |
3558 | ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); | 4466 | ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); |
3559 | 4467 | ||
4468 | wake_up_interruptible(&priv->wait_state); | ||
3560 | cancel_delayed_work(&priv->scan_check); | 4469 | cancel_delayed_work(&priv->scan_check); |
3561 | 4470 | ||
4471 | if (priv->status & STATUS_EXIT_PENDING) | ||
4472 | break; | ||
4473 | |||
4474 | priv->ieee->scans++; | ||
4475 | |||
4476 | #ifdef CONFIG_IPW2200_MONITOR | ||
4477 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | ||
4478 | priv->status |= STATUS_SCAN_FORCED; | ||
4479 | queue_work(priv->workqueue, | ||
4480 | &priv->request_scan); | ||
4481 | break; | ||
4482 | } | ||
4483 | priv->status &= ~STATUS_SCAN_FORCED; | ||
4484 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
4485 | |||
3562 | if (!(priv->status & (STATUS_ASSOCIATED | | 4486 | if (!(priv->status & (STATUS_ASSOCIATED | |
3563 | STATUS_ASSOCIATING | | 4487 | STATUS_ASSOCIATING | |
3564 | STATUS_ROAMING | | 4488 | STATUS_ROAMING | |
3565 | STATUS_DISASSOCIATING))) | 4489 | STATUS_DISASSOCIATING))) |
3566 | queue_work(priv->workqueue, &priv->associate); | 4490 | queue_work(priv->workqueue, &priv->associate); |
3567 | else if (priv->status & STATUS_ROAMING) { | 4491 | else if (priv->status & STATUS_ROAMING) { |
3568 | /* If a scan completed and we are in roam mode, then | 4492 | if (x->status == SCAN_COMPLETED_STATUS_COMPLETE) |
3569 | * the scan that completed was the one requested as a | 4493 | /* If a scan completed and we are in roam mode, then |
3570 | * result of entering roam... so, schedule the | 4494 | * the scan that completed was the one requested as a |
3571 | * roam work */ | 4495 | * result of entering roam... so, schedule the |
3572 | queue_work(priv->workqueue, &priv->roam); | 4496 | * roam work */ |
4497 | queue_work(priv->workqueue, | ||
4498 | &priv->roam); | ||
4499 | else | ||
4500 | /* Don't schedule if we aborted the scan */ | ||
4501 | priv->status &= ~STATUS_ROAMING; | ||
3573 | } else if (priv->status & STATUS_SCAN_PENDING) | 4502 | } else if (priv->status & STATUS_SCAN_PENDING) |
3574 | queue_work(priv->workqueue, | 4503 | queue_work(priv->workqueue, |
3575 | &priv->request_scan); | 4504 | &priv->request_scan); |
3576 | 4505 | else if (priv->config & CFG_BACKGROUND_SCAN | |
3577 | priv->ieee->scans++; | 4506 | && priv->status & STATUS_ASSOCIATED) |
4507 | queue_delayed_work(priv->workqueue, | ||
4508 | &priv->request_scan, HZ); | ||
3578 | break; | 4509 | break; |
3579 | } | 4510 | } |
3580 | 4511 | ||
3581 | case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{ | 4512 | case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{ |
3582 | struct notif_frag_length *x = ¬if->u.frag_len; | 4513 | struct notif_frag_length *x = ¬if->u.frag_len; |
3583 | 4514 | ||
3584 | if (notif->size == sizeof(*x)) { | 4515 | if (notif->size == sizeof(*x)) |
3585 | IPW_ERROR("Frag length: %d\n", x->frag_length); | 4516 | IPW_ERROR("Frag length: %d\n", |
3586 | } else { | 4517 | le16_to_cpu(x->frag_length)); |
4518 | else | ||
3587 | IPW_ERROR("Frag length of wrong size %d " | 4519 | IPW_ERROR("Frag length of wrong size %d " |
3588 | "(should be %zd)\n", | 4520 | "(should be %zd)\n", |
3589 | notif->size, sizeof(*x)); | 4521 | notif->size, sizeof(*x)); |
3590 | } | ||
3591 | break; | 4522 | break; |
3592 | } | 4523 | } |
3593 | 4524 | ||
3594 | case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION:{ | 4525 | case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION:{ |
3595 | struct notif_link_deterioration *x = | 4526 | struct notif_link_deterioration *x = |
3596 | ¬if->u.link_deterioration; | 4527 | ¬if->u.link_deterioration; |
4528 | |||
3597 | if (notif->size == sizeof(*x)) { | 4529 | if (notif->size == sizeof(*x)) { |
3598 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | 4530 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, |
3599 | "link deterioration: '%s' " MAC_FMT | 4531 | "link deterioration: '%s' " MAC_FMT |
@@ -3613,11 +4545,9 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3613 | case HOST_NOTIFICATION_DINO_CONFIG_RESPONSE:{ | 4545 | case HOST_NOTIFICATION_DINO_CONFIG_RESPONSE:{ |
3614 | IPW_ERROR("Dino config\n"); | 4546 | IPW_ERROR("Dino config\n"); |
3615 | if (priv->hcmd | 4547 | if (priv->hcmd |
3616 | && priv->hcmd->cmd == HOST_CMD_DINO_CONFIG) { | 4548 | && priv->hcmd->cmd != HOST_CMD_DINO_CONFIG) |
3617 | /* TODO: Do anything special? */ | ||
3618 | } else { | ||
3619 | IPW_ERROR("Unexpected DINO_CONFIG_RESPONSE\n"); | 4549 | IPW_ERROR("Unexpected DINO_CONFIG_RESPONSE\n"); |
3620 | } | 4550 | |
3621 | break; | 4551 | break; |
3622 | } | 4552 | } |
3623 | 4553 | ||
@@ -3630,36 +4560,11 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3630 | break; | 4560 | break; |
3631 | } | 4561 | } |
3632 | 4562 | ||
3633 | if (x->state == HOST_NOTIFICATION_STATUS_BEACON_MISSING) { | 4563 | if (le32_to_cpu(x->state) == |
3634 | if (priv->status & STATUS_SCANNING) { | 4564 | HOST_NOTIFICATION_STATUS_BEACON_MISSING) |
3635 | /* Stop scan to keep fw from getting | 4565 | ipw_handle_missed_beacon(priv, |
3636 | * stuck... */ | 4566 | le32_to_cpu(x-> |
3637 | queue_work(priv->workqueue, | 4567 | number)); |
3638 | &priv->abort_scan); | ||
3639 | } | ||
3640 | |||
3641 | if (x->number > priv->missed_beacon_threshold && | ||
3642 | priv->status & STATUS_ASSOCIATED) { | ||
3643 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | | ||
3644 | IPW_DL_STATE, | ||
3645 | "Missed beacon: %d - disassociate\n", | ||
3646 | x->number); | ||
3647 | queue_work(priv->workqueue, | ||
3648 | &priv->disassociate); | ||
3649 | } else if (x->number > priv->roaming_threshold) { | ||
3650 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
3651 | "Missed beacon: %d - initiate " | ||
3652 | "roaming\n", x->number); | ||
3653 | queue_work(priv->workqueue, | ||
3654 | &priv->roam); | ||
3655 | } else { | ||
3656 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", | ||
3657 | x->number); | ||
3658 | } | ||
3659 | |||
3660 | priv->notif_missed_beacons = x->number; | ||
3661 | |||
3662 | } | ||
3663 | 4568 | ||
3664 | break; | 4569 | break; |
3665 | } | 4570 | } |
@@ -3698,7 +4603,8 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3698 | case HOST_NOTIFICATION_NOISE_STATS:{ | 4603 | case HOST_NOTIFICATION_NOISE_STATS:{ |
3699 | if (notif->size == sizeof(u32)) { | 4604 | if (notif->size == sizeof(u32)) { |
3700 | priv->last_noise = | 4605 | priv->last_noise = |
3701 | (u8) (notif->u.noise.value & 0xff); | 4606 | (u8) (le32_to_cpu(notif->u.noise.value) & |
4607 | 0xff); | ||
3702 | average_add(&priv->average_noise, | 4608 | average_add(&priv->average_noise, |
3703 | priv->last_noise); | 4609 | priv->last_noise); |
3704 | break; | 4610 | break; |
@@ -3731,43 +4637,43 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
3731 | ipw_tx_queue_free(priv); | 4637 | ipw_tx_queue_free(priv); |
3732 | /* Tx CMD queue */ | 4638 | /* Tx CMD queue */ |
3733 | rc = ipw_queue_tx_init(priv, &priv->txq_cmd, nTxCmd, | 4639 | rc = ipw_queue_tx_init(priv, &priv->txq_cmd, nTxCmd, |
3734 | CX2_TX_CMD_QUEUE_READ_INDEX, | 4640 | IPW_TX_CMD_QUEUE_READ_INDEX, |
3735 | CX2_TX_CMD_QUEUE_WRITE_INDEX, | 4641 | IPW_TX_CMD_QUEUE_WRITE_INDEX, |
3736 | CX2_TX_CMD_QUEUE_BD_BASE, | 4642 | IPW_TX_CMD_QUEUE_BD_BASE, |
3737 | CX2_TX_CMD_QUEUE_BD_SIZE); | 4643 | IPW_TX_CMD_QUEUE_BD_SIZE); |
3738 | if (rc) { | 4644 | if (rc) { |
3739 | IPW_ERROR("Tx Cmd queue init failed\n"); | 4645 | IPW_ERROR("Tx Cmd queue init failed\n"); |
3740 | goto error; | 4646 | goto error; |
3741 | } | 4647 | } |
3742 | /* Tx queue(s) */ | 4648 | /* Tx queue(s) */ |
3743 | rc = ipw_queue_tx_init(priv, &priv->txq[0], nTx, | 4649 | rc = ipw_queue_tx_init(priv, &priv->txq[0], nTx, |
3744 | CX2_TX_QUEUE_0_READ_INDEX, | 4650 | IPW_TX_QUEUE_0_READ_INDEX, |
3745 | CX2_TX_QUEUE_0_WRITE_INDEX, | 4651 | IPW_TX_QUEUE_0_WRITE_INDEX, |
3746 | CX2_TX_QUEUE_0_BD_BASE, CX2_TX_QUEUE_0_BD_SIZE); | 4652 | IPW_TX_QUEUE_0_BD_BASE, IPW_TX_QUEUE_0_BD_SIZE); |
3747 | if (rc) { | 4653 | if (rc) { |
3748 | IPW_ERROR("Tx 0 queue init failed\n"); | 4654 | IPW_ERROR("Tx 0 queue init failed\n"); |
3749 | goto error; | 4655 | goto error; |
3750 | } | 4656 | } |
3751 | rc = ipw_queue_tx_init(priv, &priv->txq[1], nTx, | 4657 | rc = ipw_queue_tx_init(priv, &priv->txq[1], nTx, |
3752 | CX2_TX_QUEUE_1_READ_INDEX, | 4658 | IPW_TX_QUEUE_1_READ_INDEX, |
3753 | CX2_TX_QUEUE_1_WRITE_INDEX, | 4659 | IPW_TX_QUEUE_1_WRITE_INDEX, |
3754 | CX2_TX_QUEUE_1_BD_BASE, CX2_TX_QUEUE_1_BD_SIZE); | 4660 | IPW_TX_QUEUE_1_BD_BASE, IPW_TX_QUEUE_1_BD_SIZE); |
3755 | if (rc) { | 4661 | if (rc) { |
3756 | IPW_ERROR("Tx 1 queue init failed\n"); | 4662 | IPW_ERROR("Tx 1 queue init failed\n"); |
3757 | goto error; | 4663 | goto error; |
3758 | } | 4664 | } |
3759 | rc = ipw_queue_tx_init(priv, &priv->txq[2], nTx, | 4665 | rc = ipw_queue_tx_init(priv, &priv->txq[2], nTx, |
3760 | CX2_TX_QUEUE_2_READ_INDEX, | 4666 | IPW_TX_QUEUE_2_READ_INDEX, |
3761 | CX2_TX_QUEUE_2_WRITE_INDEX, | 4667 | IPW_TX_QUEUE_2_WRITE_INDEX, |
3762 | CX2_TX_QUEUE_2_BD_BASE, CX2_TX_QUEUE_2_BD_SIZE); | 4668 | IPW_TX_QUEUE_2_BD_BASE, IPW_TX_QUEUE_2_BD_SIZE); |
3763 | if (rc) { | 4669 | if (rc) { |
3764 | IPW_ERROR("Tx 2 queue init failed\n"); | 4670 | IPW_ERROR("Tx 2 queue init failed\n"); |
3765 | goto error; | 4671 | goto error; |
3766 | } | 4672 | } |
3767 | rc = ipw_queue_tx_init(priv, &priv->txq[3], nTx, | 4673 | rc = ipw_queue_tx_init(priv, &priv->txq[3], nTx, |
3768 | CX2_TX_QUEUE_3_READ_INDEX, | 4674 | IPW_TX_QUEUE_3_READ_INDEX, |
3769 | CX2_TX_QUEUE_3_WRITE_INDEX, | 4675 | IPW_TX_QUEUE_3_WRITE_INDEX, |
3770 | CX2_TX_QUEUE_3_BD_BASE, CX2_TX_QUEUE_3_BD_SIZE); | 4676 | IPW_TX_QUEUE_3_BD_BASE, IPW_TX_QUEUE_3_BD_SIZE); |
3771 | if (rc) { | 4677 | if (rc) { |
3772 | IPW_ERROR("Tx 3 queue init failed\n"); | 4678 | IPW_ERROR("Tx 3 queue init failed\n"); |
3773 | goto error; | 4679 | goto error; |
@@ -3815,9 +4721,10 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv, | |||
3815 | priv->tx_packets++; | 4721 | priv->tx_packets++; |
3816 | } | 4722 | } |
3817 | done: | 4723 | done: |
3818 | if (ipw_queue_space(q) > q->low_mark && qindex >= 0) { | 4724 | if ((ipw_queue_space(q) > q->low_mark) && |
3819 | __maybe_wake_tx(priv); | 4725 | (qindex >= 0) && |
3820 | } | 4726 | (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev)) |
4727 | netif_wake_queue(priv->net_dev); | ||
3821 | used = q->first_empty - q->last_used; | 4728 | used = q->first_empty - q->last_used; |
3822 | if (used < 0) | 4729 | if (used < 0) |
3823 | used += q->n_bd; | 4730 | used += q->n_bd; |
@@ -3858,7 +4765,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf, | |||
3858 | * Rx theory of operation | 4765 | * Rx theory of operation |
3859 | * | 4766 | * |
3860 | * The host allocates 32 DMA target addresses and passes the host address | 4767 | * The host allocates 32 DMA target addresses and passes the host address |
3861 | * to the firmware at register CX2_RFDS_TABLE_LOWER + N * RFD_SIZE where N is | 4768 | * to the firmware at register IPW_RFDS_TABLE_LOWER + N * RFD_SIZE where N is |
3862 | * 0 to 31 | 4769 | * 0 to 31 |
3863 | * | 4770 | * |
3864 | * Rx Queue Indexes | 4771 | * Rx Queue Indexes |
@@ -3942,7 +4849,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv) | |||
3942 | rxb = list_entry(element, struct ipw_rx_mem_buffer, list); | 4849 | rxb = list_entry(element, struct ipw_rx_mem_buffer, list); |
3943 | list_del(element); | 4850 | list_del(element); |
3944 | 4851 | ||
3945 | ipw_write32(priv, CX2_RFDS_TABLE_LOWER + rxq->write * RFD_SIZE, | 4852 | ipw_write32(priv, IPW_RFDS_TABLE_LOWER + rxq->write * RFD_SIZE, |
3946 | rxb->dma_addr); | 4853 | rxb->dma_addr); |
3947 | rxq->queue[rxq->write] = rxb; | 4854 | rxq->queue[rxq->write] = rxb; |
3948 | rxq->write = (rxq->write + 1) % RX_QUEUE_SIZE; | 4855 | rxq->write = (rxq->write + 1) % RX_QUEUE_SIZE; |
@@ -3957,7 +4864,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv) | |||
3957 | 4864 | ||
3958 | /* If we've added more space for the firmware to place data, tell it */ | 4865 | /* If we've added more space for the firmware to place data, tell it */ |
3959 | if (write != rxq->write) | 4866 | if (write != rxq->write) |
3960 | ipw_write32(priv, CX2_RX_WRITE_INDEX, rxq->write); | 4867 | ipw_write32(priv, IPW_RX_WRITE_INDEX, rxq->write); |
3961 | } | 4868 | } |
3962 | 4869 | ||
3963 | /* | 4870 | /* |
@@ -3978,7 +4885,7 @@ static void ipw_rx_queue_replenish(void *data) | |||
3978 | while (!list_empty(&rxq->rx_used)) { | 4885 | while (!list_empty(&rxq->rx_used)) { |
3979 | element = rxq->rx_used.next; | 4886 | element = rxq->rx_used.next; |
3980 | rxb = list_entry(element, struct ipw_rx_mem_buffer, list); | 4887 | rxb = list_entry(element, struct ipw_rx_mem_buffer, list); |
3981 | rxb->skb = alloc_skb(CX2_RX_BUF_SIZE, GFP_ATOMIC); | 4888 | rxb->skb = alloc_skb(IPW_RX_BUF_SIZE, GFP_ATOMIC); |
3982 | if (!rxb->skb) { | 4889 | if (!rxb->skb) { |
3983 | printk(KERN_CRIT "%s: Can not allocate SKB buffers.\n", | 4890 | printk(KERN_CRIT "%s: Can not allocate SKB buffers.\n", |
3984 | priv->net_dev->name); | 4891 | priv->net_dev->name); |
@@ -3992,7 +4899,7 @@ static void ipw_rx_queue_replenish(void *data) | |||
3992 | rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data; | 4899 | rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data; |
3993 | rxb->dma_addr = | 4900 | rxb->dma_addr = |
3994 | pci_map_single(priv->pci_dev, rxb->skb->data, | 4901 | pci_map_single(priv->pci_dev, rxb->skb->data, |
3995 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 4902 | IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
3996 | 4903 | ||
3997 | list_add_tail(&rxb->list, &rxq->rx_free); | 4904 | list_add_tail(&rxb->list, &rxq->rx_free); |
3998 | rxq->free_count++; | 4905 | rxq->free_count++; |
@@ -4002,6 +4909,14 @@ static void ipw_rx_queue_replenish(void *data) | |||
4002 | ipw_rx_queue_restock(priv); | 4909 | ipw_rx_queue_restock(priv); |
4003 | } | 4910 | } |
4004 | 4911 | ||
4912 | static void ipw_bg_rx_queue_replenish(void *data) | ||
4913 | { | ||
4914 | struct ipw_priv *priv = data; | ||
4915 | down(&priv->sem); | ||
4916 | ipw_rx_queue_replenish(data); | ||
4917 | up(&priv->sem); | ||
4918 | } | ||
4919 | |||
4005 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. | 4920 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. |
4006 | * If an SKB has been detached, the POOL needs to have it's SKB set to NULL | 4921 | * If an SKB has been detached, the POOL needs to have it's SKB set to NULL |
4007 | * This free routine walks the list of POOL entries and if SKB is set to | 4922 | * This free routine walks the list of POOL entries and if SKB is set to |
@@ -4017,7 +4932,7 @@ static void ipw_rx_queue_free(struct ipw_priv *priv, struct ipw_rx_queue *rxq) | |||
4017 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | 4932 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { |
4018 | if (rxq->pool[i].skb != NULL) { | 4933 | if (rxq->pool[i].skb != NULL) { |
4019 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, | 4934 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, |
4020 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 4935 | IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
4021 | dev_kfree_skb(rxq->pool[i].skb); | 4936 | dev_kfree_skb(rxq->pool[i].skb); |
4022 | } | 4937 | } |
4023 | } | 4938 | } |
@@ -4136,8 +5051,18 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
4136 | num_rates = min(network->rates_len, (u8) IPW_MAX_RATES); | 5051 | num_rates = min(network->rates_len, (u8) IPW_MAX_RATES); |
4137 | rates->num_rates = 0; | 5052 | rates->num_rates = 0; |
4138 | for (i = 0; i < num_rates; i++) { | 5053 | for (i = 0; i < num_rates; i++) { |
4139 | if (!ipw_is_rate_in_mask | 5054 | if (!ipw_is_rate_in_mask(priv, network->mode, |
4140 | (priv, network->mode, network->rates[i])) { | 5055 | network->rates[i])) { |
5056 | |||
5057 | if (network->rates[i] & IEEE80211_BASIC_RATE_MASK) { | ||
5058 | IPW_DEBUG_SCAN("Adding masked mandatory " | ||
5059 | "rate %02X\n", | ||
5060 | network->rates[i]); | ||
5061 | rates->supported_rates[rates->num_rates++] = | ||
5062 | network->rates[i]; | ||
5063 | continue; | ||
5064 | } | ||
5065 | |||
4141 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", | 5066 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", |
4142 | network->rates[i], priv->rates_mask); | 5067 | network->rates[i], priv->rates_mask); |
4143 | continue; | 5068 | continue; |
@@ -4146,11 +5071,20 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
4146 | rates->supported_rates[rates->num_rates++] = network->rates[i]; | 5071 | rates->supported_rates[rates->num_rates++] = network->rates[i]; |
4147 | } | 5072 | } |
4148 | 5073 | ||
4149 | num_rates = | 5074 | num_rates = min(network->rates_ex_len, |
4150 | min(network->rates_ex_len, (u8) (IPW_MAX_RATES - num_rates)); | 5075 | (u8) (IPW_MAX_RATES - num_rates)); |
4151 | for (i = 0; i < num_rates; i++) { | 5076 | for (i = 0; i < num_rates; i++) { |
4152 | if (!ipw_is_rate_in_mask | 5077 | if (!ipw_is_rate_in_mask(priv, network->mode, |
4153 | (priv, network->mode, network->rates_ex[i])) { | 5078 | network->rates_ex[i])) { |
5079 | if (network->rates_ex[i] & IEEE80211_BASIC_RATE_MASK) { | ||
5080 | IPW_DEBUG_SCAN("Adding masked mandatory " | ||
5081 | "rate %02X\n", | ||
5082 | network->rates_ex[i]); | ||
5083 | rates->supported_rates[rates->num_rates++] = | ||
5084 | network->rates[i]; | ||
5085 | continue; | ||
5086 | } | ||
5087 | |||
4154 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", | 5088 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", |
4155 | network->rates_ex[i], priv->rates_mask); | 5089 | network->rates_ex[i], priv->rates_mask); |
4156 | continue; | 5090 | continue; |
@@ -4160,7 +5094,7 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
4160 | network->rates_ex[i]; | 5094 | network->rates_ex[i]; |
4161 | } | 5095 | } |
4162 | 5096 | ||
4163 | return rates->num_rates; | 5097 | return 1; |
4164 | } | 5098 | } |
4165 | 5099 | ||
4166 | static inline void ipw_copy_rates(struct ipw_supported_rates *dest, | 5100 | static inline void ipw_copy_rates(struct ipw_supported_rates *dest, |
@@ -4242,6 +5176,216 @@ struct ipw_network_match { | |||
4242 | struct ipw_supported_rates rates; | 5176 | struct ipw_supported_rates rates; |
4243 | }; | 5177 | }; |
4244 | 5178 | ||
5179 | static int ipw_find_adhoc_network(struct ipw_priv *priv, | ||
5180 | struct ipw_network_match *match, | ||
5181 | struct ieee80211_network *network, | ||
5182 | int roaming) | ||
5183 | { | ||
5184 | struct ipw_supported_rates rates; | ||
5185 | |||
5186 | /* Verify that this network's capability is compatible with the | ||
5187 | * current mode (AdHoc or Infrastructure) */ | ||
5188 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC && | ||
5189 | !(network->capability & WLAN_CAPABILITY_IBSS))) { | ||
5190 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded due to " | ||
5191 | "capability mismatch.\n", | ||
5192 | escape_essid(network->ssid, network->ssid_len), | ||
5193 | MAC_ARG(network->bssid)); | ||
5194 | return 0; | ||
5195 | } | ||
5196 | |||
5197 | /* If we do not have an ESSID for this AP, we can not associate with | ||
5198 | * it */ | ||
5199 | if (network->flags & NETWORK_EMPTY_ESSID) { | ||
5200 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5201 | "because of hidden ESSID.\n", | ||
5202 | escape_essid(network->ssid, network->ssid_len), | ||
5203 | MAC_ARG(network->bssid)); | ||
5204 | return 0; | ||
5205 | } | ||
5206 | |||
5207 | if (unlikely(roaming)) { | ||
5208 | /* If we are roaming, then ensure check if this is a valid | ||
5209 | * network to try and roam to */ | ||
5210 | if ((network->ssid_len != match->network->ssid_len) || | ||
5211 | memcmp(network->ssid, match->network->ssid, | ||
5212 | network->ssid_len)) { | ||
5213 | IPW_DEBUG_MERGE("Netowrk '%s (" MAC_FMT ")' excluded " | ||
5214 | "because of non-network ESSID.\n", | ||
5215 | escape_essid(network->ssid, | ||
5216 | network->ssid_len), | ||
5217 | MAC_ARG(network->bssid)); | ||
5218 | return 0; | ||
5219 | } | ||
5220 | } else { | ||
5221 | /* If an ESSID has been configured then compare the broadcast | ||
5222 | * ESSID to ours */ | ||
5223 | if ((priv->config & CFG_STATIC_ESSID) && | ||
5224 | ((network->ssid_len != priv->essid_len) || | ||
5225 | memcmp(network->ssid, priv->essid, | ||
5226 | min(network->ssid_len, priv->essid_len)))) { | ||
5227 | char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
5228 | |||
5229 | strncpy(escaped, | ||
5230 | escape_essid(network->ssid, network->ssid_len), | ||
5231 | sizeof(escaped)); | ||
5232 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5233 | "because of ESSID mismatch: '%s'.\n", | ||
5234 | escaped, MAC_ARG(network->bssid), | ||
5235 | escape_essid(priv->essid, | ||
5236 | priv->essid_len)); | ||
5237 | return 0; | ||
5238 | } | ||
5239 | } | ||
5240 | |||
5241 | /* If the old network rate is better than this one, don't bother | ||
5242 | * testing everything else. */ | ||
5243 | |||
5244 | if (network->time_stamp[0] < match->network->time_stamp[0]) { | ||
5245 | IPW_DEBUG_MERGE("Network '%s excluded because newer than " | ||
5246 | "current network.\n", | ||
5247 | escape_essid(match->network->ssid, | ||
5248 | match->network->ssid_len)); | ||
5249 | return 0; | ||
5250 | } else if (network->time_stamp[1] < match->network->time_stamp[1]) { | ||
5251 | IPW_DEBUG_MERGE("Network '%s excluded because newer than " | ||
5252 | "current network.\n", | ||
5253 | escape_essid(match->network->ssid, | ||
5254 | match->network->ssid_len)); | ||
5255 | return 0; | ||
5256 | } | ||
5257 | |||
5258 | /* Now go through and see if the requested network is valid... */ | ||
5259 | if (priv->ieee->scan_age != 0 && | ||
5260 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { | ||
5261 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5262 | "because of age: %lums.\n", | ||
5263 | escape_essid(network->ssid, network->ssid_len), | ||
5264 | MAC_ARG(network->bssid), | ||
5265 | 1000 * (jiffies - network->last_scanned) / HZ); | ||
5266 | return 0; | ||
5267 | } | ||
5268 | |||
5269 | if ((priv->config & CFG_STATIC_CHANNEL) && | ||
5270 | (network->channel != priv->channel)) { | ||
5271 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5272 | "because of channel mismatch: %d != %d.\n", | ||
5273 | escape_essid(network->ssid, network->ssid_len), | ||
5274 | MAC_ARG(network->bssid), | ||
5275 | network->channel, priv->channel); | ||
5276 | return 0; | ||
5277 | } | ||
5278 | |||
5279 | /* Verify privacy compatability */ | ||
5280 | if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) != | ||
5281 | ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { | ||
5282 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5283 | "because of privacy mismatch: %s != %s.\n", | ||
5284 | escape_essid(network->ssid, network->ssid_len), | ||
5285 | MAC_ARG(network->bssid), | ||
5286 | priv-> | ||
5287 | capability & CAP_PRIVACY_ON ? "on" : "off", | ||
5288 | network-> | ||
5289 | capability & WLAN_CAPABILITY_PRIVACY ? "on" : | ||
5290 | "off"); | ||
5291 | return 0; | ||
5292 | } | ||
5293 | |||
5294 | if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { | ||
5295 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5296 | "because of the same BSSID match: " MAC_FMT | ||
5297 | ".\n", escape_essid(network->ssid, | ||
5298 | network->ssid_len), | ||
5299 | MAC_ARG(network->bssid), MAC_ARG(priv->bssid)); | ||
5300 | return 0; | ||
5301 | } | ||
5302 | |||
5303 | /* Filter out any incompatible freq / mode combinations */ | ||
5304 | if (!ieee80211_is_valid_mode(priv->ieee, network->mode)) { | ||
5305 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5306 | "because of invalid frequency/mode " | ||
5307 | "combination.\n", | ||
5308 | escape_essid(network->ssid, network->ssid_len), | ||
5309 | MAC_ARG(network->bssid)); | ||
5310 | return 0; | ||
5311 | } | ||
5312 | |||
5313 | /* Ensure that the rates supported by the driver are compatible with | ||
5314 | * this AP, including verification of basic rates (mandatory) */ | ||
5315 | if (!ipw_compatible_rates(priv, network, &rates)) { | ||
5316 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5317 | "because configured rate mask excludes " | ||
5318 | "AP mandatory rate.\n", | ||
5319 | escape_essid(network->ssid, network->ssid_len), | ||
5320 | MAC_ARG(network->bssid)); | ||
5321 | return 0; | ||
5322 | } | ||
5323 | |||
5324 | if (rates.num_rates == 0) { | ||
5325 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5326 | "because of no compatible rates.\n", | ||
5327 | escape_essid(network->ssid, network->ssid_len), | ||
5328 | MAC_ARG(network->bssid)); | ||
5329 | return 0; | ||
5330 | } | ||
5331 | |||
5332 | /* TODO: Perform any further minimal comparititive tests. We do not | ||
5333 | * want to put too much policy logic here; intelligent scan selection | ||
5334 | * should occur within a generic IEEE 802.11 user space tool. */ | ||
5335 | |||
5336 | /* Set up 'new' AP to this network */ | ||
5337 | ipw_copy_rates(&match->rates, &rates); | ||
5338 | match->network = network; | ||
5339 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' is a viable match.\n", | ||
5340 | escape_essid(network->ssid, network->ssid_len), | ||
5341 | MAC_ARG(network->bssid)); | ||
5342 | |||
5343 | return 1; | ||
5344 | } | ||
5345 | |||
5346 | static void ipw_merge_adhoc_network(void *data) | ||
5347 | { | ||
5348 | struct ipw_priv *priv = data; | ||
5349 | struct ieee80211_network *network = NULL; | ||
5350 | struct ipw_network_match match = { | ||
5351 | .network = priv->assoc_network | ||
5352 | }; | ||
5353 | |||
5354 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5355 | (priv->ieee->iw_mode == IW_MODE_ADHOC)) { | ||
5356 | /* First pass through ROAM process -- look for a better | ||
5357 | * network */ | ||
5358 | unsigned long flags; | ||
5359 | |||
5360 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
5361 | list_for_each_entry(network, &priv->ieee->network_list, list) { | ||
5362 | if (network != priv->assoc_network) | ||
5363 | ipw_find_adhoc_network(priv, &match, network, | ||
5364 | 1); | ||
5365 | } | ||
5366 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
5367 | |||
5368 | if (match.network == priv->assoc_network) { | ||
5369 | IPW_DEBUG_MERGE("No better ADHOC in this network to " | ||
5370 | "merge to.\n"); | ||
5371 | return; | ||
5372 | } | ||
5373 | |||
5374 | down(&priv->sem); | ||
5375 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { | ||
5376 | IPW_DEBUG_MERGE("remove network %s\n", | ||
5377 | escape_essid(priv->essid, | ||
5378 | priv->essid_len)); | ||
5379 | ipw_remove_current_network(priv); | ||
5380 | } | ||
5381 | |||
5382 | ipw_disassociate(priv); | ||
5383 | priv->assoc_network = match.network; | ||
5384 | up(&priv->sem); | ||
5385 | return; | ||
5386 | } | ||
5387 | } | ||
5388 | |||
4245 | static int ipw_best_network(struct ipw_priv *priv, | 5389 | static int ipw_best_network(struct ipw_priv *priv, |
4246 | struct ipw_network_match *match, | 5390 | struct ipw_network_match *match, |
4247 | struct ieee80211_network *network, int roaming) | 5391 | struct ieee80211_network *network, int roaming) |
@@ -4323,9 +5467,9 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4323 | /* If this network has already had an association attempt within the | 5467 | /* If this network has already had an association attempt within the |
4324 | * last 3 seconds, do not try and associate again... */ | 5468 | * last 3 seconds, do not try and associate again... */ |
4325 | if (network->last_associate && | 5469 | if (network->last_associate && |
4326 | time_after(network->last_associate + (HZ * 5UL), jiffies)) { | 5470 | time_after(network->last_associate + (HZ * 3UL), jiffies)) { |
4327 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5471 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
4328 | "because of storming (%lu since last " | 5472 | "because of storming (%lus since last " |
4329 | "assoc attempt).\n", | 5473 | "assoc attempt).\n", |
4330 | escape_essid(network->ssid, network->ssid_len), | 5474 | escape_essid(network->ssid, network->ssid_len), |
4331 | MAC_ARG(network->bssid), | 5475 | MAC_ARG(network->bssid), |
@@ -4335,12 +5479,12 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4335 | 5479 | ||
4336 | /* Now go through and see if the requested network is valid... */ | 5480 | /* Now go through and see if the requested network is valid... */ |
4337 | if (priv->ieee->scan_age != 0 && | 5481 | if (priv->ieee->scan_age != 0 && |
4338 | jiffies - network->last_scanned > priv->ieee->scan_age) { | 5482 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { |
4339 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5483 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
4340 | "because of age: %lums.\n", | 5484 | "because of age: %lums.\n", |
4341 | escape_essid(network->ssid, network->ssid_len), | 5485 | escape_essid(network->ssid, network->ssid_len), |
4342 | MAC_ARG(network->bssid), | 5486 | MAC_ARG(network->bssid), |
4343 | (jiffies - network->last_scanned) / (HZ / 100)); | 5487 | 1000 * (jiffies - network->last_scanned) / HZ); |
4344 | return 0; | 5488 | return 0; |
4345 | } | 5489 | } |
4346 | 5490 | ||
@@ -4368,6 +5512,15 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4368 | return 0; | 5512 | return 0; |
4369 | } | 5513 | } |
4370 | 5514 | ||
5515 | if (!priv->ieee->wpa_enabled && (network->wpa_ie_len > 0 || | ||
5516 | network->rsn_ie_len > 0)) { | ||
5517 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | ||
5518 | "because of WPA capability mismatch.\n", | ||
5519 | escape_essid(network->ssid, network->ssid_len), | ||
5520 | MAC_ARG(network->bssid)); | ||
5521 | return 0; | ||
5522 | } | ||
5523 | |||
4371 | if ((priv->config & CFG_STATIC_BSSID) && | 5524 | if ((priv->config & CFG_STATIC_BSSID) && |
4372 | memcmp(network->bssid, priv->bssid, ETH_ALEN)) { | 5525 | memcmp(network->bssid, priv->bssid, ETH_ALEN)) { |
4373 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5526 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
@@ -4387,7 +5540,26 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4387 | return 0; | 5540 | return 0; |
4388 | } | 5541 | } |
4389 | 5542 | ||
4390 | ipw_compatible_rates(priv, network, &rates); | 5543 | /* Filter out invalid channel in current GEO */ |
5544 | if (!ipw_is_valid_channel(priv->ieee, network->channel)) { | ||
5545 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | ||
5546 | "because of invalid channel in current GEO\n", | ||
5547 | escape_essid(network->ssid, network->ssid_len), | ||
5548 | MAC_ARG(network->bssid)); | ||
5549 | return 0; | ||
5550 | } | ||
5551 | |||
5552 | /* Ensure that the rates supported by the driver are compatible with | ||
5553 | * this AP, including verification of basic rates (mandatory) */ | ||
5554 | if (!ipw_compatible_rates(priv, network, &rates)) { | ||
5555 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | ||
5556 | "because configured rate mask excludes " | ||
5557 | "AP mandatory rate.\n", | ||
5558 | escape_essid(network->ssid, network->ssid_len), | ||
5559 | MAC_ARG(network->bssid)); | ||
5560 | return 0; | ||
5561 | } | ||
5562 | |||
4391 | if (rates.num_rates == 0) { | 5563 | if (rates.num_rates == 0) { |
4392 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5564 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
4393 | "because of no compatible rates.\n", | 5565 | "because of no compatible rates.\n", |
@@ -4414,6 +5586,9 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4414 | static void ipw_adhoc_create(struct ipw_priv *priv, | 5586 | static void ipw_adhoc_create(struct ipw_priv *priv, |
4415 | struct ieee80211_network *network) | 5587 | struct ieee80211_network *network) |
4416 | { | 5588 | { |
5589 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | ||
5590 | int i; | ||
5591 | |||
4417 | /* | 5592 | /* |
4418 | * For the purposes of scanning, we can set our wireless mode | 5593 | * For the purposes of scanning, we can set our wireless mode |
4419 | * to trigger scans across combinations of bands, but when it | 5594 | * to trigger scans across combinations of bands, but when it |
@@ -4424,22 +5599,47 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
4424 | * chossen band. Attempting to create a new ad-hoc network | 5599 | * chossen band. Attempting to create a new ad-hoc network |
4425 | * with an invalid channel for wireless mode will trigger a | 5600 | * with an invalid channel for wireless mode will trigger a |
4426 | * FW fatal error. | 5601 | * FW fatal error. |
5602 | * | ||
4427 | */ | 5603 | */ |
4428 | network->mode = is_valid_channel(priv->ieee->mode, priv->channel); | 5604 | switch (ipw_is_valid_channel(priv->ieee, priv->channel)) { |
4429 | if (network->mode) { | 5605 | case IEEE80211_52GHZ_BAND: |
4430 | network->channel = priv->channel; | 5606 | network->mode = IEEE_A; |
4431 | } else { | 5607 | i = ipw_channel_to_index(priv->ieee, priv->channel); |
5608 | if (i == -1) | ||
5609 | BUG(); | ||
5610 | if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { | ||
5611 | IPW_WARNING("Overriding invalid channel\n"); | ||
5612 | priv->channel = geo->a[0].channel; | ||
5613 | } | ||
5614 | break; | ||
5615 | |||
5616 | case IEEE80211_24GHZ_BAND: | ||
5617 | if (priv->ieee->mode & IEEE_G) | ||
5618 | network->mode = IEEE_G; | ||
5619 | else | ||
5620 | network->mode = IEEE_B; | ||
5621 | i = ipw_channel_to_index(priv->ieee, priv->channel); | ||
5622 | if (i == -1) | ||
5623 | BUG(); | ||
5624 | if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) { | ||
5625 | IPW_WARNING("Overriding invalid channel\n"); | ||
5626 | priv->channel = geo->bg[0].channel; | ||
5627 | } | ||
5628 | break; | ||
5629 | |||
5630 | default: | ||
4432 | IPW_WARNING("Overriding invalid channel\n"); | 5631 | IPW_WARNING("Overriding invalid channel\n"); |
4433 | if (priv->ieee->mode & IEEE_A) { | 5632 | if (priv->ieee->mode & IEEE_A) { |
4434 | network->mode = IEEE_A; | 5633 | network->mode = IEEE_A; |
4435 | priv->channel = band_a_active_channel[0]; | 5634 | priv->channel = geo->a[0].channel; |
4436 | } else if (priv->ieee->mode & IEEE_G) { | 5635 | } else if (priv->ieee->mode & IEEE_G) { |
4437 | network->mode = IEEE_G; | 5636 | network->mode = IEEE_G; |
4438 | priv->channel = band_b_active_channel[0]; | 5637 | priv->channel = geo->bg[0].channel; |
4439 | } else { | 5638 | } else { |
4440 | network->mode = IEEE_B; | 5639 | network->mode = IEEE_B; |
4441 | priv->channel = band_b_active_channel[0]; | 5640 | priv->channel = geo->bg[0].channel; |
4442 | } | 5641 | } |
5642 | break; | ||
4443 | } | 5643 | } |
4444 | 5644 | ||
4445 | network->channel = priv->channel; | 5645 | network->channel = priv->channel; |
@@ -4449,6 +5649,8 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
4449 | memcpy(network->ssid, priv->essid, priv->essid_len); | 5649 | memcpy(network->ssid, priv->essid, priv->essid_len); |
4450 | memset(&network->stats, 0, sizeof(network->stats)); | 5650 | memset(&network->stats, 0, sizeof(network->stats)); |
4451 | network->capability = WLAN_CAPABILITY_IBSS; | 5651 | network->capability = WLAN_CAPABILITY_IBSS; |
5652 | if (!(priv->config & CFG_PREAMBLE_LONG)) | ||
5653 | network->capability |= WLAN_CAPABILITY_SHORT_PREAMBLE; | ||
4452 | if (priv->capability & CAP_PRIVACY_ON) | 5654 | if (priv->capability & CAP_PRIVACY_ON) |
4453 | network->capability |= WLAN_CAPABILITY_PRIVACY; | 5655 | network->capability |= WLAN_CAPABILITY_PRIVACY; |
4454 | network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); | 5656 | network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); |
@@ -4465,13 +5667,35 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
4465 | network->beacon_interval = 100; /* Default */ | 5667 | network->beacon_interval = 100; /* Default */ |
4466 | network->listen_interval = 10; /* Default */ | 5668 | network->listen_interval = 10; /* Default */ |
4467 | network->atim_window = 0; /* Default */ | 5669 | network->atim_window = 0; /* Default */ |
4468 | #ifdef CONFIG_IEEE80211_WPA | ||
4469 | network->wpa_ie_len = 0; | 5670 | network->wpa_ie_len = 0; |
4470 | network->rsn_ie_len = 0; | 5671 | network->rsn_ie_len = 0; |
4471 | #endif /* CONFIG_IEEE80211_WPA */ | ||
4472 | } | 5672 | } |
4473 | 5673 | ||
4474 | static void ipw_send_wep_keys(struct ipw_priv *priv) | 5674 | static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) |
5675 | { | ||
5676 | struct ipw_tgi_tx_key *key; | ||
5677 | struct host_cmd cmd = { | ||
5678 | .cmd = IPW_CMD_TGI_TX_KEY, | ||
5679 | .len = sizeof(*key) | ||
5680 | }; | ||
5681 | |||
5682 | if (!(priv->ieee->sec.flags & (1 << index))) | ||
5683 | return; | ||
5684 | |||
5685 | key = (struct ipw_tgi_tx_key *)&cmd.param; | ||
5686 | key->key_id = index; | ||
5687 | memcpy(key->key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); | ||
5688 | key->security_type = type; | ||
5689 | key->station_index = 0; /* always 0 for BSS */ | ||
5690 | key->flags = 0; | ||
5691 | /* 0 for new key; previous value of counter (after fatal error) */ | ||
5692 | key->tx_counter[0] = 0; | ||
5693 | key->tx_counter[1] = 0; | ||
5694 | |||
5695 | ipw_send_cmd(priv, &cmd); | ||
5696 | } | ||
5697 | |||
5698 | static void ipw_send_wep_keys(struct ipw_priv *priv, int type) | ||
4475 | { | 5699 | { |
4476 | struct ipw_wep_key *key; | 5700 | struct ipw_wep_key *key; |
4477 | int i; | 5701 | int i; |
@@ -4484,19 +5708,97 @@ static void ipw_send_wep_keys(struct ipw_priv *priv) | |||
4484 | key->cmd_id = DINO_CMD_WEP_KEY; | 5708 | key->cmd_id = DINO_CMD_WEP_KEY; |
4485 | key->seq_num = 0; | 5709 | key->seq_num = 0; |
4486 | 5710 | ||
5711 | /* Note: AES keys cannot be set for multiple times. | ||
5712 | * Only set it at the first time. */ | ||
4487 | for (i = 0; i < 4; i++) { | 5713 | for (i = 0; i < 4; i++) { |
4488 | key->key_index = i; | 5714 | key->key_index = i | type; |
4489 | if (!(priv->sec.flags & (1 << i))) { | 5715 | if (!(priv->ieee->sec.flags & (1 << i))) { |
4490 | key->key_size = 0; | 5716 | key->key_size = 0; |
4491 | } else { | 5717 | continue; |
4492 | key->key_size = priv->sec.key_sizes[i]; | ||
4493 | memcpy(key->key, priv->sec.keys[i], key->key_size); | ||
4494 | } | 5718 | } |
4495 | 5719 | ||
4496 | if (ipw_send_cmd(priv, &cmd)) { | 5720 | key->key_size = priv->ieee->sec.key_sizes[i]; |
4497 | IPW_ERROR("failed to send WEP_KEY command\n"); | 5721 | memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); |
4498 | return; | 5722 | |
4499 | } | 5723 | ipw_send_cmd(priv, &cmd); |
5724 | } | ||
5725 | } | ||
5726 | |||
5727 | static void ipw_set_hw_decrypt_unicast(struct ipw_priv *priv, int level) | ||
5728 | { | ||
5729 | if (priv->ieee->host_encrypt) | ||
5730 | return; | ||
5731 | |||
5732 | switch (level) { | ||
5733 | case SEC_LEVEL_3: | ||
5734 | priv->sys_config.disable_unicast_decryption = 0; | ||
5735 | priv->ieee->host_decrypt = 0; | ||
5736 | break; | ||
5737 | case SEC_LEVEL_2: | ||
5738 | priv->sys_config.disable_unicast_decryption = 1; | ||
5739 | priv->ieee->host_decrypt = 1; | ||
5740 | break; | ||
5741 | case SEC_LEVEL_1: | ||
5742 | priv->sys_config.disable_unicast_decryption = 0; | ||
5743 | priv->ieee->host_decrypt = 0; | ||
5744 | break; | ||
5745 | case SEC_LEVEL_0: | ||
5746 | priv->sys_config.disable_unicast_decryption = 1; | ||
5747 | break; | ||
5748 | default: | ||
5749 | break; | ||
5750 | } | ||
5751 | } | ||
5752 | |||
5753 | static void ipw_set_hw_decrypt_multicast(struct ipw_priv *priv, int level) | ||
5754 | { | ||
5755 | if (priv->ieee->host_encrypt) | ||
5756 | return; | ||
5757 | |||
5758 | switch (level) { | ||
5759 | case SEC_LEVEL_3: | ||
5760 | priv->sys_config.disable_multicast_decryption = 0; | ||
5761 | break; | ||
5762 | case SEC_LEVEL_2: | ||
5763 | priv->sys_config.disable_multicast_decryption = 1; | ||
5764 | break; | ||
5765 | case SEC_LEVEL_1: | ||
5766 | priv->sys_config.disable_multicast_decryption = 0; | ||
5767 | break; | ||
5768 | case SEC_LEVEL_0: | ||
5769 | priv->sys_config.disable_multicast_decryption = 1; | ||
5770 | break; | ||
5771 | default: | ||
5772 | break; | ||
5773 | } | ||
5774 | } | ||
5775 | |||
5776 | static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) | ||
5777 | { | ||
5778 | switch (priv->ieee->sec.level) { | ||
5779 | case SEC_LEVEL_3: | ||
5780 | if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) | ||
5781 | ipw_send_tgi_tx_key(priv, | ||
5782 | DCT_FLAG_EXT_SECURITY_CCM, | ||
5783 | priv->ieee->sec.active_key); | ||
5784 | |||
5785 | if (!priv->ieee->host_mc_decrypt) | ||
5786 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); | ||
5787 | break; | ||
5788 | case SEC_LEVEL_2: | ||
5789 | if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) | ||
5790 | ipw_send_tgi_tx_key(priv, | ||
5791 | DCT_FLAG_EXT_SECURITY_TKIP, | ||
5792 | priv->ieee->sec.active_key); | ||
5793 | break; | ||
5794 | case SEC_LEVEL_1: | ||
5795 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); | ||
5796 | ipw_set_hw_decrypt_unicast(priv, priv->ieee->sec.level); | ||
5797 | ipw_set_hw_decrypt_multicast(priv, priv->ieee->sec.level); | ||
5798 | break; | ||
5799 | case SEC_LEVEL_0: | ||
5800 | default: | ||
5801 | break; | ||
4500 | } | 5802 | } |
4501 | } | 5803 | } |
4502 | 5804 | ||
@@ -4504,9 +5806,12 @@ static void ipw_adhoc_check(void *data) | |||
4504 | { | 5806 | { |
4505 | struct ipw_priv *priv = data; | 5807 | struct ipw_priv *priv = data; |
4506 | 5808 | ||
4507 | if (priv->missed_adhoc_beacons++ > priv->missed_beacon_threshold && | 5809 | if (priv->missed_adhoc_beacons++ > priv->disassociate_threshold && |
4508 | !(priv->config & CFG_ADHOC_PERSIST)) { | 5810 | !(priv->config & CFG_ADHOC_PERSIST)) { |
4509 | IPW_DEBUG_SCAN("Disassociating due to missed beacons\n"); | 5811 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | |
5812 | IPW_DL_STATE | IPW_DL_ASSOC, | ||
5813 | "Missed beacon: %d - disassociate\n", | ||
5814 | priv->missed_adhoc_beacons); | ||
4510 | ipw_remove_current_network(priv); | 5815 | ipw_remove_current_network(priv); |
4511 | ipw_disassociate(priv); | 5816 | ipw_disassociate(priv); |
4512 | return; | 5817 | return; |
@@ -4516,6 +5821,14 @@ static void ipw_adhoc_check(void *data) | |||
4516 | priv->assoc_request.beacon_interval); | 5821 | priv->assoc_request.beacon_interval); |
4517 | } | 5822 | } |
4518 | 5823 | ||
5824 | static void ipw_bg_adhoc_check(void *data) | ||
5825 | { | ||
5826 | struct ipw_priv *priv = data; | ||
5827 | down(&priv->sem); | ||
5828 | ipw_adhoc_check(data); | ||
5829 | up(&priv->sem); | ||
5830 | } | ||
5831 | |||
4519 | #ifdef CONFIG_IPW_DEBUG | 5832 | #ifdef CONFIG_IPW_DEBUG |
4520 | static void ipw_debug_config(struct ipw_priv *priv) | 5833 | static void ipw_debug_config(struct ipw_priv *priv) |
4521 | { | 5834 | { |
@@ -4531,7 +5844,8 @@ static void ipw_debug_config(struct ipw_priv *priv) | |||
4531 | else | 5844 | else |
4532 | IPW_DEBUG_INFO("ESSID unlocked.\n"); | 5845 | IPW_DEBUG_INFO("ESSID unlocked.\n"); |
4533 | if (priv->config & CFG_STATIC_BSSID) | 5846 | if (priv->config & CFG_STATIC_BSSID) |
4534 | IPW_DEBUG_INFO("BSSID locked to %d\n", priv->channel); | 5847 | IPW_DEBUG_INFO("BSSID locked to " MAC_FMT "\n", |
5848 | MAC_ARG(priv->bssid)); | ||
4535 | else | 5849 | else |
4536 | IPW_DEBUG_INFO("BSSID unlocked.\n"); | 5850 | IPW_DEBUG_INFO("BSSID unlocked.\n"); |
4537 | if (priv->capability & CAP_PRIVACY_ON) | 5851 | if (priv->capability & CAP_PRIVACY_ON) |
@@ -4544,8 +5858,7 @@ static void ipw_debug_config(struct ipw_priv *priv) | |||
4544 | #define ipw_debug_config(x) do {} while (0) | 5858 | #define ipw_debug_config(x) do {} while (0) |
4545 | #endif | 5859 | #endif |
4546 | 5860 | ||
4547 | static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | 5861 | static inline void ipw_set_fixed_rate(struct ipw_priv *priv, int mode) |
4548 | struct ieee80211_network *network) | ||
4549 | { | 5862 | { |
4550 | /* TODO: Verify that this works... */ | 5863 | /* TODO: Verify that this works... */ |
4551 | struct ipw_fixed_rate fr = { | 5864 | struct ipw_fixed_rate fr = { |
@@ -4562,6 +5875,8 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4562 | /* IEEE_A */ | 5875 | /* IEEE_A */ |
4563 | if (priv->rates_mask & ~IEEE80211_OFDM_RATES_MASK) { | 5876 | if (priv->rates_mask & ~IEEE80211_OFDM_RATES_MASK) { |
4564 | /* Invalid fixed rate mask */ | 5877 | /* Invalid fixed rate mask */ |
5878 | IPW_DEBUG_WX | ||
5879 | ("invalid fixed rate mask in ipw_set_fixed_rate\n"); | ||
4565 | fr.tx_rates = 0; | 5880 | fr.tx_rates = 0; |
4566 | break; | 5881 | break; |
4567 | } | 5882 | } |
@@ -4571,9 +5886,11 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4571 | 5886 | ||
4572 | default: /* 2.4Ghz or Mixed */ | 5887 | default: /* 2.4Ghz or Mixed */ |
4573 | /* IEEE_B */ | 5888 | /* IEEE_B */ |
4574 | if (network->mode == IEEE_B) { | 5889 | if (mode == IEEE_B) { |
4575 | if (fr.tx_rates & ~IEEE80211_CCK_RATES_MASK) { | 5890 | if (fr.tx_rates & ~IEEE80211_CCK_RATES_MASK) { |
4576 | /* Invalid fixed rate mask */ | 5891 | /* Invalid fixed rate mask */ |
5892 | IPW_DEBUG_WX | ||
5893 | ("invalid fixed rate mask in ipw_set_fixed_rate\n"); | ||
4577 | fr.tx_rates = 0; | 5894 | fr.tx_rates = 0; |
4578 | } | 5895 | } |
4579 | break; | 5896 | break; |
@@ -4583,6 +5900,8 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4583 | if (fr.tx_rates & ~(IEEE80211_CCK_RATES_MASK | | 5900 | if (fr.tx_rates & ~(IEEE80211_CCK_RATES_MASK | |
4584 | IEEE80211_OFDM_RATES_MASK)) { | 5901 | IEEE80211_OFDM_RATES_MASK)) { |
4585 | /* Invalid fixed rate mask */ | 5902 | /* Invalid fixed rate mask */ |
5903 | IPW_DEBUG_WX | ||
5904 | ("invalid fixed rate mask in ipw_set_fixed_rate\n"); | ||
4586 | fr.tx_rates = 0; | 5905 | fr.tx_rates = 0; |
4587 | break; | 5906 | break; |
4588 | } | 5907 | } |
@@ -4610,6 +5929,1112 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4610 | ipw_write_reg32(priv, reg, *(u32 *) & fr); | 5929 | ipw_write_reg32(priv, reg, *(u32 *) & fr); |
4611 | } | 5930 | } |
4612 | 5931 | ||
5932 | static void ipw_abort_scan(struct ipw_priv *priv) | ||
5933 | { | ||
5934 | int err; | ||
5935 | |||
5936 | if (priv->status & STATUS_SCAN_ABORTING) { | ||
5937 | IPW_DEBUG_HC("Ignoring concurrent scan abort request.\n"); | ||
5938 | return; | ||
5939 | } | ||
5940 | priv->status |= STATUS_SCAN_ABORTING; | ||
5941 | |||
5942 | err = ipw_send_scan_abort(priv); | ||
5943 | if (err) | ||
5944 | IPW_DEBUG_HC("Request to abort scan failed.\n"); | ||
5945 | } | ||
5946 | |||
5947 | static void ipw_add_scan_channels(struct ipw_priv *priv, | ||
5948 | struct ipw_scan_request_ext *scan, | ||
5949 | int scan_type) | ||
5950 | { | ||
5951 | int channel_index = 0; | ||
5952 | const struct ieee80211_geo *geo; | ||
5953 | int i; | ||
5954 | |||
5955 | geo = ipw_get_geo(priv->ieee); | ||
5956 | |||
5957 | if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { | ||
5958 | int start = channel_index; | ||
5959 | for (i = 0; i < geo->a_channels; i++) { | ||
5960 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5961 | geo->a[i].channel == priv->channel) | ||
5962 | continue; | ||
5963 | channel_index++; | ||
5964 | scan->channels_list[channel_index] = geo->a[i].channel; | ||
5965 | ipw_set_scan_type(scan, channel_index, | ||
5966 | geo->a[i]. | ||
5967 | flags & IEEE80211_CH_PASSIVE_ONLY ? | ||
5968 | IPW_SCAN_PASSIVE_FULL_DWELL_SCAN : | ||
5969 | scan_type); | ||
5970 | } | ||
5971 | |||
5972 | if (start != channel_index) { | ||
5973 | scan->channels_list[start] = (u8) (IPW_A_MODE << 6) | | ||
5974 | (channel_index - start); | ||
5975 | channel_index++; | ||
5976 | } | ||
5977 | } | ||
5978 | |||
5979 | if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { | ||
5980 | int start = channel_index; | ||
5981 | if (priv->config & CFG_SPEED_SCAN) { | ||
5982 | int index; | ||
5983 | u8 channels[IEEE80211_24GHZ_CHANNELS] = { | ||
5984 | /* nop out the list */ | ||
5985 | [0] = 0 | ||
5986 | }; | ||
5987 | |||
5988 | u8 channel; | ||
5989 | while (channel_index < IPW_SCAN_CHANNELS) { | ||
5990 | channel = | ||
5991 | priv->speed_scan[priv->speed_scan_pos]; | ||
5992 | if (channel == 0) { | ||
5993 | priv->speed_scan_pos = 0; | ||
5994 | channel = priv->speed_scan[0]; | ||
5995 | } | ||
5996 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5997 | channel == priv->channel) { | ||
5998 | priv->speed_scan_pos++; | ||
5999 | continue; | ||
6000 | } | ||
6001 | |||
6002 | /* If this channel has already been | ||
6003 | * added in scan, break from loop | ||
6004 | * and this will be the first channel | ||
6005 | * in the next scan. | ||
6006 | */ | ||
6007 | if (channels[channel - 1] != 0) | ||
6008 | break; | ||
6009 | |||
6010 | channels[channel - 1] = 1; | ||
6011 | priv->speed_scan_pos++; | ||
6012 | channel_index++; | ||
6013 | scan->channels_list[channel_index] = channel; | ||
6014 | index = | ||
6015 | ipw_channel_to_index(priv->ieee, channel); | ||
6016 | ipw_set_scan_type(scan, channel_index, | ||
6017 | geo->bg[index]. | ||
6018 | flags & | ||
6019 | IEEE80211_CH_PASSIVE_ONLY ? | ||
6020 | IPW_SCAN_PASSIVE_FULL_DWELL_SCAN | ||
6021 | : scan_type); | ||
6022 | } | ||
6023 | } else { | ||
6024 | for (i = 0; i < geo->bg_channels; i++) { | ||
6025 | if ((priv->status & STATUS_ASSOCIATED) && | ||
6026 | geo->bg[i].channel == priv->channel) | ||
6027 | continue; | ||
6028 | channel_index++; | ||
6029 | scan->channels_list[channel_index] = | ||
6030 | geo->bg[i].channel; | ||
6031 | ipw_set_scan_type(scan, channel_index, | ||
6032 | geo->bg[i]. | ||
6033 | flags & | ||
6034 | IEEE80211_CH_PASSIVE_ONLY ? | ||
6035 | IPW_SCAN_PASSIVE_FULL_DWELL_SCAN | ||
6036 | : scan_type); | ||
6037 | } | ||
6038 | } | ||
6039 | |||
6040 | if (start != channel_index) { | ||
6041 | scan->channels_list[start] = (u8) (IPW_B_MODE << 6) | | ||
6042 | (channel_index - start); | ||
6043 | } | ||
6044 | } | ||
6045 | } | ||
6046 | |||
6047 | static int ipw_request_scan(struct ipw_priv *priv) | ||
6048 | { | ||
6049 | struct ipw_scan_request_ext scan; | ||
6050 | int err = 0, scan_type; | ||
6051 | |||
6052 | if (!(priv->status & STATUS_INIT) || | ||
6053 | (priv->status & STATUS_EXIT_PENDING)) | ||
6054 | return 0; | ||
6055 | |||
6056 | down(&priv->sem); | ||
6057 | |||
6058 | if (priv->status & STATUS_SCANNING) { | ||
6059 | IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); | ||
6060 | priv->status |= STATUS_SCAN_PENDING; | ||
6061 | goto done; | ||
6062 | } | ||
6063 | |||
6064 | if (!(priv->status & STATUS_SCAN_FORCED) && | ||
6065 | priv->status & STATUS_SCAN_ABORTING) { | ||
6066 | IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); | ||
6067 | priv->status |= STATUS_SCAN_PENDING; | ||
6068 | goto done; | ||
6069 | } | ||
6070 | |||
6071 | if (priv->status & STATUS_RF_KILL_MASK) { | ||
6072 | IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); | ||
6073 | priv->status |= STATUS_SCAN_PENDING; | ||
6074 | goto done; | ||
6075 | } | ||
6076 | |||
6077 | memset(&scan, 0, sizeof(scan)); | ||
6078 | |||
6079 | if (priv->config & CFG_SPEED_SCAN) | ||
6080 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
6081 | cpu_to_le16(30); | ||
6082 | else | ||
6083 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
6084 | cpu_to_le16(20); | ||
6085 | |||
6086 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = | ||
6087 | cpu_to_le16(20); | ||
6088 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); | ||
6089 | |||
6090 | scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); | ||
6091 | |||
6092 | #ifdef CONFIG_IPW2200_MONITOR | ||
6093 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | ||
6094 | u8 channel; | ||
6095 | u8 band = 0; | ||
6096 | |||
6097 | switch (ipw_is_valid_channel(priv->ieee, priv->channel)) { | ||
6098 | case IEEE80211_52GHZ_BAND: | ||
6099 | band = (u8) (IPW_A_MODE << 6) | 1; | ||
6100 | channel = priv->channel; | ||
6101 | break; | ||
6102 | |||
6103 | case IEEE80211_24GHZ_BAND: | ||
6104 | band = (u8) (IPW_B_MODE << 6) | 1; | ||
6105 | channel = priv->channel; | ||
6106 | break; | ||
6107 | |||
6108 | default: | ||
6109 | band = (u8) (IPW_B_MODE << 6) | 1; | ||
6110 | channel = 9; | ||
6111 | break; | ||
6112 | } | ||
6113 | |||
6114 | scan.channels_list[0] = band; | ||
6115 | scan.channels_list[1] = channel; | ||
6116 | ipw_set_scan_type(&scan, 1, IPW_SCAN_PASSIVE_FULL_DWELL_SCAN); | ||
6117 | |||
6118 | /* NOTE: The card will sit on this channel for this time | ||
6119 | * period. Scan aborts are timing sensitive and frequently | ||
6120 | * result in firmware restarts. As such, it is best to | ||
6121 | * set a small dwell_time here and just keep re-issuing | ||
6122 | * scans. Otherwise fast channel hopping will not actually | ||
6123 | * hop channels. | ||
6124 | * | ||
6125 | * TODO: Move SPEED SCAN support to all modes and bands */ | ||
6126 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = | ||
6127 | cpu_to_le16(2000); | ||
6128 | } else { | ||
6129 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
6130 | /* If we are roaming, then make this a directed scan for the | ||
6131 | * current network. Otherwise, ensure that every other scan | ||
6132 | * is a fast channel hop scan */ | ||
6133 | if ((priv->status & STATUS_ROAMING) | ||
6134 | || (!(priv->status & STATUS_ASSOCIATED) | ||
6135 | && (priv->config & CFG_STATIC_ESSID) | ||
6136 | && (le32_to_cpu(scan.full_scan_index) % 2))) { | ||
6137 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); | ||
6138 | if (err) { | ||
6139 | IPW_DEBUG_HC("Attempt to send SSID command " | ||
6140 | "failed.\n"); | ||
6141 | goto done; | ||
6142 | } | ||
6143 | |||
6144 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; | ||
6145 | } else | ||
6146 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; | ||
6147 | |||
6148 | ipw_add_scan_channels(priv, &scan, scan_type); | ||
6149 | #ifdef CONFIG_IPW2200_MONITOR | ||
6150 | } | ||
6151 | #endif | ||
6152 | |||
6153 | err = ipw_send_scan_request_ext(priv, &scan); | ||
6154 | if (err) { | ||
6155 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); | ||
6156 | goto done; | ||
6157 | } | ||
6158 | |||
6159 | priv->status |= STATUS_SCANNING; | ||
6160 | priv->status &= ~STATUS_SCAN_PENDING; | ||
6161 | queue_delayed_work(priv->workqueue, &priv->scan_check, | ||
6162 | IPW_SCAN_CHECK_WATCHDOG); | ||
6163 | done: | ||
6164 | up(&priv->sem); | ||
6165 | return err; | ||
6166 | } | ||
6167 | |||
6168 | static void ipw_bg_abort_scan(void *data) | ||
6169 | { | ||
6170 | struct ipw_priv *priv = data; | ||
6171 | down(&priv->sem); | ||
6172 | ipw_abort_scan(data); | ||
6173 | up(&priv->sem); | ||
6174 | } | ||
6175 | |||
6176 | static int ipw_wpa_enable(struct ipw_priv *priv, int value) | ||
6177 | { | ||
6178 | /* This is called when wpa_supplicant loads and closes the driver | ||
6179 | * interface. */ | ||
6180 | priv->ieee->wpa_enabled = value; | ||
6181 | return 0; | ||
6182 | } | ||
6183 | |||
6184 | static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) | ||
6185 | { | ||
6186 | struct ieee80211_device *ieee = priv->ieee; | ||
6187 | struct ieee80211_security sec = { | ||
6188 | .flags = SEC_AUTH_MODE, | ||
6189 | }; | ||
6190 | int ret = 0; | ||
6191 | |||
6192 | if (value & IW_AUTH_ALG_SHARED_KEY) { | ||
6193 | sec.auth_mode = WLAN_AUTH_SHARED_KEY; | ||
6194 | ieee->open_wep = 0; | ||
6195 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { | ||
6196 | sec.auth_mode = WLAN_AUTH_OPEN; | ||
6197 | ieee->open_wep = 1; | ||
6198 | } else | ||
6199 | return -EINVAL; | ||
6200 | |||
6201 | if (ieee->set_security) | ||
6202 | ieee->set_security(ieee->dev, &sec); | ||
6203 | else | ||
6204 | ret = -EOPNOTSUPP; | ||
6205 | |||
6206 | return ret; | ||
6207 | } | ||
6208 | |||
6209 | void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) | ||
6210 | { | ||
6211 | /* make sure WPA is enabled */ | ||
6212 | ipw_wpa_enable(priv, 1); | ||
6213 | |||
6214 | ipw_disassociate(priv); | ||
6215 | } | ||
6216 | |||
6217 | static int ipw_set_rsn_capa(struct ipw_priv *priv, | ||
6218 | char *capabilities, int length) | ||
6219 | { | ||
6220 | struct host_cmd cmd = { | ||
6221 | .cmd = IPW_CMD_RSN_CAPABILITIES, | ||
6222 | .len = length, | ||
6223 | }; | ||
6224 | |||
6225 | IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); | ||
6226 | |||
6227 | memcpy(cmd.param, capabilities, length); | ||
6228 | return ipw_send_cmd(priv, &cmd); | ||
6229 | } | ||
6230 | |||
6231 | /* | ||
6232 | * WE-18 support | ||
6233 | */ | ||
6234 | |||
6235 | /* SIOCSIWGENIE */ | ||
6236 | static int ipw_wx_set_genie(struct net_device *dev, | ||
6237 | struct iw_request_info *info, | ||
6238 | union iwreq_data *wrqu, char *extra) | ||
6239 | { | ||
6240 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6241 | struct ieee80211_device *ieee = priv->ieee; | ||
6242 | u8 *buf; | ||
6243 | int err = 0; | ||
6244 | |||
6245 | if (wrqu->data.length > MAX_WPA_IE_LEN || | ||
6246 | (wrqu->data.length && extra == NULL)) | ||
6247 | return -EINVAL; | ||
6248 | |||
6249 | //down(&priv->sem); | ||
6250 | |||
6251 | //if (!ieee->wpa_enabled) { | ||
6252 | // err = -EOPNOTSUPP; | ||
6253 | // goto out; | ||
6254 | //} | ||
6255 | |||
6256 | if (wrqu->data.length) { | ||
6257 | buf = kmalloc(wrqu->data.length, GFP_KERNEL); | ||
6258 | if (buf == NULL) { | ||
6259 | err = -ENOMEM; | ||
6260 | goto out; | ||
6261 | } | ||
6262 | |||
6263 | memcpy(buf, extra, wrqu->data.length); | ||
6264 | kfree(ieee->wpa_ie); | ||
6265 | ieee->wpa_ie = buf; | ||
6266 | ieee->wpa_ie_len = wrqu->data.length; | ||
6267 | } else { | ||
6268 | kfree(ieee->wpa_ie); | ||
6269 | ieee->wpa_ie = NULL; | ||
6270 | ieee->wpa_ie_len = 0; | ||
6271 | } | ||
6272 | |||
6273 | ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); | ||
6274 | out: | ||
6275 | //up(&priv->sem); | ||
6276 | return err; | ||
6277 | } | ||
6278 | |||
6279 | /* SIOCGIWGENIE */ | ||
6280 | static int ipw_wx_get_genie(struct net_device *dev, | ||
6281 | struct iw_request_info *info, | ||
6282 | union iwreq_data *wrqu, char *extra) | ||
6283 | { | ||
6284 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6285 | struct ieee80211_device *ieee = priv->ieee; | ||
6286 | int err = 0; | ||
6287 | |||
6288 | //down(&priv->sem); | ||
6289 | |||
6290 | //if (!ieee->wpa_enabled) { | ||
6291 | // err = -EOPNOTSUPP; | ||
6292 | // goto out; | ||
6293 | //} | ||
6294 | |||
6295 | if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { | ||
6296 | wrqu->data.length = 0; | ||
6297 | goto out; | ||
6298 | } | ||
6299 | |||
6300 | if (wrqu->data.length < ieee->wpa_ie_len) { | ||
6301 | err = -E2BIG; | ||
6302 | goto out; | ||
6303 | } | ||
6304 | |||
6305 | wrqu->data.length = ieee->wpa_ie_len; | ||
6306 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); | ||
6307 | |||
6308 | out: | ||
6309 | //up(&priv->sem); | ||
6310 | return err; | ||
6311 | } | ||
6312 | |||
6313 | static int wext_cipher2level(int cipher) | ||
6314 | { | ||
6315 | switch (cipher) { | ||
6316 | case IW_AUTH_CIPHER_NONE: | ||
6317 | return SEC_LEVEL_0; | ||
6318 | case IW_AUTH_CIPHER_WEP40: | ||
6319 | case IW_AUTH_CIPHER_WEP104: | ||
6320 | return SEC_LEVEL_1; | ||
6321 | case IW_AUTH_CIPHER_TKIP: | ||
6322 | return SEC_LEVEL_2; | ||
6323 | case IW_AUTH_CIPHER_CCMP: | ||
6324 | return SEC_LEVEL_3; | ||
6325 | default: | ||
6326 | return -1; | ||
6327 | } | ||
6328 | } | ||
6329 | |||
6330 | /* SIOCSIWAUTH */ | ||
6331 | static int ipw_wx_set_auth(struct net_device *dev, | ||
6332 | struct iw_request_info *info, | ||
6333 | union iwreq_data *wrqu, char *extra) | ||
6334 | { | ||
6335 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6336 | struct ieee80211_device *ieee = priv->ieee; | ||
6337 | struct iw_param *param = &wrqu->param; | ||
6338 | struct ieee80211_crypt_data *crypt; | ||
6339 | unsigned long flags; | ||
6340 | int ret = 0; | ||
6341 | |||
6342 | switch (param->flags & IW_AUTH_INDEX) { | ||
6343 | case IW_AUTH_WPA_VERSION: | ||
6344 | break; | ||
6345 | case IW_AUTH_CIPHER_PAIRWISE: | ||
6346 | ipw_set_hw_decrypt_unicast(priv, | ||
6347 | wext_cipher2level(param->value)); | ||
6348 | break; | ||
6349 | case IW_AUTH_CIPHER_GROUP: | ||
6350 | ipw_set_hw_decrypt_multicast(priv, | ||
6351 | wext_cipher2level(param->value)); | ||
6352 | break; | ||
6353 | case IW_AUTH_KEY_MGMT: | ||
6354 | /* | ||
6355 | * ipw2200 does not use these parameters | ||
6356 | */ | ||
6357 | break; | ||
6358 | |||
6359 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
6360 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
6361 | if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) | ||
6362 | break; | ||
6363 | |||
6364 | flags = crypt->ops->get_flags(crypt->priv); | ||
6365 | |||
6366 | if (param->value) | ||
6367 | flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
6368 | else | ||
6369 | flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
6370 | |||
6371 | crypt->ops->set_flags(flags, crypt->priv); | ||
6372 | |||
6373 | break; | ||
6374 | |||
6375 | case IW_AUTH_DROP_UNENCRYPTED:{ | ||
6376 | /* HACK: | ||
6377 | * | ||
6378 | * wpa_supplicant calls set_wpa_enabled when the driver | ||
6379 | * is loaded and unloaded, regardless of if WPA is being | ||
6380 | * used. No other calls are made which can be used to | ||
6381 | * determine if encryption will be used or not prior to | ||
6382 | * association being expected. If encryption is not being | ||
6383 | * used, drop_unencrypted is set to false, else true -- we | ||
6384 | * can use this to determine if the CAP_PRIVACY_ON bit should | ||
6385 | * be set. | ||
6386 | */ | ||
6387 | struct ieee80211_security sec = { | ||
6388 | .flags = SEC_ENABLED, | ||
6389 | .enabled = param->value, | ||
6390 | }; | ||
6391 | priv->ieee->drop_unencrypted = param->value; | ||
6392 | /* We only change SEC_LEVEL for open mode. Others | ||
6393 | * are set by ipw_wpa_set_encryption. | ||
6394 | */ | ||
6395 | if (!param->value) { | ||
6396 | sec.flags |= SEC_LEVEL; | ||
6397 | sec.level = SEC_LEVEL_0; | ||
6398 | } else { | ||
6399 | sec.flags |= SEC_LEVEL; | ||
6400 | sec.level = SEC_LEVEL_1; | ||
6401 | } | ||
6402 | if (priv->ieee->set_security) | ||
6403 | priv->ieee->set_security(priv->ieee->dev, &sec); | ||
6404 | break; | ||
6405 | } | ||
6406 | |||
6407 | case IW_AUTH_80211_AUTH_ALG: | ||
6408 | ret = ipw_wpa_set_auth_algs(priv, param->value); | ||
6409 | break; | ||
6410 | |||
6411 | case IW_AUTH_WPA_ENABLED: | ||
6412 | ret = ipw_wpa_enable(priv, param->value); | ||
6413 | break; | ||
6414 | |||
6415 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
6416 | ieee->ieee802_1x = param->value; | ||
6417 | break; | ||
6418 | |||
6419 | //case IW_AUTH_ROAMING_CONTROL: | ||
6420 | case IW_AUTH_PRIVACY_INVOKED: | ||
6421 | ieee->privacy_invoked = param->value; | ||
6422 | break; | ||
6423 | |||
6424 | default: | ||
6425 | return -EOPNOTSUPP; | ||
6426 | } | ||
6427 | return ret; | ||
6428 | } | ||
6429 | |||
6430 | /* SIOCGIWAUTH */ | ||
6431 | static int ipw_wx_get_auth(struct net_device *dev, | ||
6432 | struct iw_request_info *info, | ||
6433 | union iwreq_data *wrqu, char *extra) | ||
6434 | { | ||
6435 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6436 | struct ieee80211_device *ieee = priv->ieee; | ||
6437 | struct ieee80211_crypt_data *crypt; | ||
6438 | struct iw_param *param = &wrqu->param; | ||
6439 | int ret = 0; | ||
6440 | |||
6441 | switch (param->flags & IW_AUTH_INDEX) { | ||
6442 | case IW_AUTH_WPA_VERSION: | ||
6443 | case IW_AUTH_CIPHER_PAIRWISE: | ||
6444 | case IW_AUTH_CIPHER_GROUP: | ||
6445 | case IW_AUTH_KEY_MGMT: | ||
6446 | /* | ||
6447 | * wpa_supplicant will control these internally | ||
6448 | */ | ||
6449 | ret = -EOPNOTSUPP; | ||
6450 | break; | ||
6451 | |||
6452 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
6453 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
6454 | if (!crypt || !crypt->ops->get_flags) | ||
6455 | break; | ||
6456 | |||
6457 | param->value = (crypt->ops->get_flags(crypt->priv) & | ||
6458 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; | ||
6459 | |||
6460 | break; | ||
6461 | |||
6462 | case IW_AUTH_DROP_UNENCRYPTED: | ||
6463 | param->value = ieee->drop_unencrypted; | ||
6464 | break; | ||
6465 | |||
6466 | case IW_AUTH_80211_AUTH_ALG: | ||
6467 | param->value = ieee->sec.auth_mode; | ||
6468 | break; | ||
6469 | |||
6470 | case IW_AUTH_WPA_ENABLED: | ||
6471 | param->value = ieee->wpa_enabled; | ||
6472 | break; | ||
6473 | |||
6474 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
6475 | param->value = ieee->ieee802_1x; | ||
6476 | break; | ||
6477 | |||
6478 | case IW_AUTH_ROAMING_CONTROL: | ||
6479 | case IW_AUTH_PRIVACY_INVOKED: | ||
6480 | param->value = ieee->privacy_invoked; | ||
6481 | break; | ||
6482 | |||
6483 | default: | ||
6484 | return -EOPNOTSUPP; | ||
6485 | } | ||
6486 | return 0; | ||
6487 | } | ||
6488 | |||
6489 | /* SIOCSIWENCODEEXT */ | ||
6490 | static int ipw_wx_set_encodeext(struct net_device *dev, | ||
6491 | struct iw_request_info *info, | ||
6492 | union iwreq_data *wrqu, char *extra) | ||
6493 | { | ||
6494 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6495 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
6496 | |||
6497 | if (hwcrypto) { | ||
6498 | if (ext->alg == IW_ENCODE_ALG_TKIP) { | ||
6499 | /* IPW HW can't build TKIP MIC, | ||
6500 | host decryption still needed */ | ||
6501 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) | ||
6502 | priv->ieee->host_mc_decrypt = 1; | ||
6503 | else { | ||
6504 | priv->ieee->host_encrypt = 0; | ||
6505 | priv->ieee->host_encrypt_msdu = 1; | ||
6506 | priv->ieee->host_decrypt = 1; | ||
6507 | } | ||
6508 | } else { | ||
6509 | priv->ieee->host_encrypt = 0; | ||
6510 | priv->ieee->host_encrypt_msdu = 0; | ||
6511 | priv->ieee->host_decrypt = 0; | ||
6512 | priv->ieee->host_mc_decrypt = 0; | ||
6513 | } | ||
6514 | } | ||
6515 | |||
6516 | return ieee80211_wx_set_encodeext(priv->ieee, info, wrqu, extra); | ||
6517 | } | ||
6518 | |||
6519 | /* SIOCGIWENCODEEXT */ | ||
6520 | static int ipw_wx_get_encodeext(struct net_device *dev, | ||
6521 | struct iw_request_info *info, | ||
6522 | union iwreq_data *wrqu, char *extra) | ||
6523 | { | ||
6524 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6525 | return ieee80211_wx_get_encodeext(priv->ieee, info, wrqu, extra); | ||
6526 | } | ||
6527 | |||
6528 | /* SIOCSIWMLME */ | ||
6529 | static int ipw_wx_set_mlme(struct net_device *dev, | ||
6530 | struct iw_request_info *info, | ||
6531 | union iwreq_data *wrqu, char *extra) | ||
6532 | { | ||
6533 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6534 | struct iw_mlme *mlme = (struct iw_mlme *)extra; | ||
6535 | u16 reason; | ||
6536 | |||
6537 | reason = cpu_to_le16(mlme->reason_code); | ||
6538 | |||
6539 | switch (mlme->cmd) { | ||
6540 | case IW_MLME_DEAUTH: | ||
6541 | // silently ignore | ||
6542 | break; | ||
6543 | |||
6544 | case IW_MLME_DISASSOC: | ||
6545 | ipw_disassociate(priv); | ||
6546 | break; | ||
6547 | |||
6548 | default: | ||
6549 | return -EOPNOTSUPP; | ||
6550 | } | ||
6551 | return 0; | ||
6552 | } | ||
6553 | |||
6554 | #ifdef CONFIG_IPW_QOS | ||
6555 | |||
6556 | /* QoS */ | ||
6557 | /* | ||
6558 | * get the modulation type of the current network or | ||
6559 | * the card current mode | ||
6560 | */ | ||
6561 | u8 ipw_qos_current_mode(struct ipw_priv * priv) | ||
6562 | { | ||
6563 | u8 mode = 0; | ||
6564 | |||
6565 | if (priv->status & STATUS_ASSOCIATED) { | ||
6566 | unsigned long flags; | ||
6567 | |||
6568 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
6569 | mode = priv->assoc_network->mode; | ||
6570 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
6571 | } else { | ||
6572 | mode = priv->ieee->mode; | ||
6573 | } | ||
6574 | IPW_DEBUG_QOS("QoS network/card mode %d \n", mode); | ||
6575 | return mode; | ||
6576 | } | ||
6577 | |||
6578 | /* | ||
6579 | * Handle management frame beacon and probe response | ||
6580 | */ | ||
6581 | static int ipw_qos_handle_probe_response(struct ipw_priv *priv, | ||
6582 | int active_network, | ||
6583 | struct ieee80211_network *network) | ||
6584 | { | ||
6585 | u32 size = sizeof(struct ieee80211_qos_parameters); | ||
6586 | |||
6587 | if (network->capability & WLAN_CAPABILITY_IBSS) | ||
6588 | network->qos_data.active = network->qos_data.supported; | ||
6589 | |||
6590 | if (network->flags & NETWORK_HAS_QOS_MASK) { | ||
6591 | if (active_network && | ||
6592 | (network->flags & NETWORK_HAS_QOS_PARAMETERS)) | ||
6593 | network->qos_data.active = network->qos_data.supported; | ||
6594 | |||
6595 | if ((network->qos_data.active == 1) && (active_network == 1) && | ||
6596 | (network->flags & NETWORK_HAS_QOS_PARAMETERS) && | ||
6597 | (network->qos_data.old_param_count != | ||
6598 | network->qos_data.param_count)) { | ||
6599 | network->qos_data.old_param_count = | ||
6600 | network->qos_data.param_count; | ||
6601 | schedule_work(&priv->qos_activate); | ||
6602 | IPW_DEBUG_QOS("QoS parameters change call " | ||
6603 | "qos_activate\n"); | ||
6604 | } | ||
6605 | } else { | ||
6606 | if ((priv->ieee->mode == IEEE_B) || (network->mode == IEEE_B)) | ||
6607 | memcpy(&network->qos_data.parameters, | ||
6608 | &def_parameters_CCK, size); | ||
6609 | else | ||
6610 | memcpy(&network->qos_data.parameters, | ||
6611 | &def_parameters_OFDM, size); | ||
6612 | |||
6613 | if ((network->qos_data.active == 1) && (active_network == 1)) { | ||
6614 | IPW_DEBUG_QOS("QoS was disabled call qos_activate \n"); | ||
6615 | schedule_work(&priv->qos_activate); | ||
6616 | } | ||
6617 | |||
6618 | network->qos_data.active = 0; | ||
6619 | network->qos_data.supported = 0; | ||
6620 | } | ||
6621 | if ((priv->status & STATUS_ASSOCIATED) && | ||
6622 | (priv->ieee->iw_mode == IW_MODE_ADHOC) && (active_network == 0)) { | ||
6623 | if (memcmp(network->bssid, priv->bssid, ETH_ALEN)) | ||
6624 | if ((network->capability & WLAN_CAPABILITY_IBSS) && | ||
6625 | !(network->flags & NETWORK_EMPTY_ESSID)) | ||
6626 | if ((network->ssid_len == | ||
6627 | priv->assoc_network->ssid_len) && | ||
6628 | !memcmp(network->ssid, | ||
6629 | priv->assoc_network->ssid, | ||
6630 | network->ssid_len)) { | ||
6631 | queue_work(priv->workqueue, | ||
6632 | &priv->merge_networks); | ||
6633 | } | ||
6634 | } | ||
6635 | |||
6636 | return 0; | ||
6637 | } | ||
6638 | |||
6639 | /* | ||
6640 | * This function set up the firmware to support QoS. It sends | ||
6641 | * IPW_CMD_QOS_PARAMETERS and IPW_CMD_WME_INFO | ||
6642 | */ | ||
6643 | static int ipw_qos_activate(struct ipw_priv *priv, | ||
6644 | struct ieee80211_qos_data *qos_network_data) | ||
6645 | { | ||
6646 | int err; | ||
6647 | struct ieee80211_qos_parameters qos_parameters[QOS_QOS_SETS]; | ||
6648 | struct ieee80211_qos_parameters *active_one = NULL; | ||
6649 | u32 size = sizeof(struct ieee80211_qos_parameters); | ||
6650 | u32 burst_duration; | ||
6651 | int i; | ||
6652 | u8 type; | ||
6653 | |||
6654 | type = ipw_qos_current_mode(priv); | ||
6655 | |||
6656 | active_one = &(qos_parameters[QOS_PARAM_SET_DEF_CCK]); | ||
6657 | memcpy(active_one, priv->qos_data.def_qos_parm_CCK, size); | ||
6658 | active_one = &(qos_parameters[QOS_PARAM_SET_DEF_OFDM]); | ||
6659 | memcpy(active_one, priv->qos_data.def_qos_parm_OFDM, size); | ||
6660 | |||
6661 | if (qos_network_data == NULL) { | ||
6662 | if (type == IEEE_B) { | ||
6663 | IPW_DEBUG_QOS("QoS activate network mode %d\n", type); | ||
6664 | active_one = &def_parameters_CCK; | ||
6665 | } else | ||
6666 | active_one = &def_parameters_OFDM; | ||
6667 | |||
6668 | memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); | ||
6669 | burst_duration = ipw_qos_get_burst_duration(priv); | ||
6670 | for (i = 0; i < QOS_QUEUE_NUM; i++) | ||
6671 | qos_parameters[QOS_PARAM_SET_ACTIVE].tx_op_limit[i] = | ||
6672 | (u16) burst_duration; | ||
6673 | } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | ||
6674 | if (type == IEEE_B) { | ||
6675 | IPW_DEBUG_QOS("QoS activate IBSS nework mode %d\n", | ||
6676 | type); | ||
6677 | if (priv->qos_data.qos_enable == 0) | ||
6678 | active_one = &def_parameters_CCK; | ||
6679 | else | ||
6680 | active_one = priv->qos_data.def_qos_parm_CCK; | ||
6681 | } else { | ||
6682 | if (priv->qos_data.qos_enable == 0) | ||
6683 | active_one = &def_parameters_OFDM; | ||
6684 | else | ||
6685 | active_one = priv->qos_data.def_qos_parm_OFDM; | ||
6686 | } | ||
6687 | memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); | ||
6688 | } else { | ||
6689 | unsigned long flags; | ||
6690 | int active; | ||
6691 | |||
6692 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
6693 | active_one = &(qos_network_data->parameters); | ||
6694 | qos_network_data->old_param_count = | ||
6695 | qos_network_data->param_count; | ||
6696 | memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); | ||
6697 | active = qos_network_data->supported; | ||
6698 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
6699 | |||
6700 | if (active == 0) { | ||
6701 | burst_duration = ipw_qos_get_burst_duration(priv); | ||
6702 | for (i = 0; i < QOS_QUEUE_NUM; i++) | ||
6703 | qos_parameters[QOS_PARAM_SET_ACTIVE]. | ||
6704 | tx_op_limit[i] = (u16) burst_duration; | ||
6705 | } | ||
6706 | } | ||
6707 | |||
6708 | IPW_DEBUG_QOS("QoS sending IPW_CMD_QOS_PARAMETERS\n"); | ||
6709 | err = ipw_send_qos_params_command(priv, | ||
6710 | (struct ieee80211_qos_parameters *) | ||
6711 | &(qos_parameters[0])); | ||
6712 | if (err) | ||
6713 | IPW_DEBUG_QOS("QoS IPW_CMD_QOS_PARAMETERS failed\n"); | ||
6714 | |||
6715 | return err; | ||
6716 | } | ||
6717 | |||
6718 | /* | ||
6719 | * send IPW_CMD_WME_INFO to the firmware | ||
6720 | */ | ||
6721 | static int ipw_qos_set_info_element(struct ipw_priv *priv) | ||
6722 | { | ||
6723 | int ret = 0; | ||
6724 | struct ieee80211_qos_information_element qos_info; | ||
6725 | |||
6726 | if (priv == NULL) | ||
6727 | return -1; | ||
6728 | |||
6729 | qos_info.elementID = QOS_ELEMENT_ID; | ||
6730 | qos_info.length = sizeof(struct ieee80211_qos_information_element) - 2; | ||
6731 | |||
6732 | qos_info.version = QOS_VERSION_1; | ||
6733 | qos_info.ac_info = 0; | ||
6734 | |||
6735 | memcpy(qos_info.qui, qos_oui, QOS_OUI_LEN); | ||
6736 | qos_info.qui_type = QOS_OUI_TYPE; | ||
6737 | qos_info.qui_subtype = QOS_OUI_INFO_SUB_TYPE; | ||
6738 | |||
6739 | ret = ipw_send_qos_info_command(priv, &qos_info); | ||
6740 | if (ret != 0) { | ||
6741 | IPW_DEBUG_QOS("QoS error calling ipw_send_qos_info_command\n"); | ||
6742 | } | ||
6743 | return ret; | ||
6744 | } | ||
6745 | |||
6746 | /* | ||
6747 | * Set the QoS parameter with the association request structure | ||
6748 | */ | ||
6749 | static int ipw_qos_association(struct ipw_priv *priv, | ||
6750 | struct ieee80211_network *network) | ||
6751 | { | ||
6752 | int err = 0; | ||
6753 | struct ieee80211_qos_data *qos_data = NULL; | ||
6754 | struct ieee80211_qos_data ibss_data = { | ||
6755 | .supported = 1, | ||
6756 | .active = 1, | ||
6757 | }; | ||
6758 | |||
6759 | switch (priv->ieee->iw_mode) { | ||
6760 | case IW_MODE_ADHOC: | ||
6761 | if (!(network->capability & WLAN_CAPABILITY_IBSS)) | ||
6762 | BUG(); | ||
6763 | |||
6764 | qos_data = &ibss_data; | ||
6765 | break; | ||
6766 | |||
6767 | case IW_MODE_INFRA: | ||
6768 | qos_data = &network->qos_data; | ||
6769 | break; | ||
6770 | |||
6771 | default: | ||
6772 | BUG(); | ||
6773 | break; | ||
6774 | } | ||
6775 | |||
6776 | err = ipw_qos_activate(priv, qos_data); | ||
6777 | if (err) { | ||
6778 | priv->assoc_request.policy_support &= ~HC_QOS_SUPPORT_ASSOC; | ||
6779 | return err; | ||
6780 | } | ||
6781 | |||
6782 | if (priv->qos_data.qos_enable && qos_data->supported) { | ||
6783 | IPW_DEBUG_QOS("QoS will be enabled for this association\n"); | ||
6784 | priv->assoc_request.policy_support |= HC_QOS_SUPPORT_ASSOC; | ||
6785 | return ipw_qos_set_info_element(priv); | ||
6786 | } | ||
6787 | |||
6788 | return 0; | ||
6789 | } | ||
6790 | |||
6791 | /* | ||
6792 | * handling the beaconing responces. if we get different QoS setting | ||
6793 | * of the network from the the associated setting adjust the QoS | ||
6794 | * setting | ||
6795 | */ | ||
6796 | static int ipw_qos_association_resp(struct ipw_priv *priv, | ||
6797 | struct ieee80211_network *network) | ||
6798 | { | ||
6799 | int ret = 0; | ||
6800 | unsigned long flags; | ||
6801 | u32 size = sizeof(struct ieee80211_qos_parameters); | ||
6802 | int set_qos_param = 0; | ||
6803 | |||
6804 | if ((priv == NULL) || (network == NULL) || | ||
6805 | (priv->assoc_network == NULL)) | ||
6806 | return ret; | ||
6807 | |||
6808 | if (!(priv->status & STATUS_ASSOCIATED)) | ||
6809 | return ret; | ||
6810 | |||
6811 | if ((priv->ieee->iw_mode != IW_MODE_INFRA)) | ||
6812 | return ret; | ||
6813 | |||
6814 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
6815 | if (network->flags & NETWORK_HAS_QOS_PARAMETERS) { | ||
6816 | memcpy(&priv->assoc_network->qos_data, &network->qos_data, | ||
6817 | sizeof(struct ieee80211_qos_data)); | ||
6818 | priv->assoc_network->qos_data.active = 1; | ||
6819 | if ((network->qos_data.old_param_count != | ||
6820 | network->qos_data.param_count)) { | ||
6821 | set_qos_param = 1; | ||
6822 | network->qos_data.old_param_count = | ||
6823 | network->qos_data.param_count; | ||
6824 | } | ||
6825 | |||
6826 | } else { | ||
6827 | if ((network->mode == IEEE_B) || (priv->ieee->mode == IEEE_B)) | ||
6828 | memcpy(&priv->assoc_network->qos_data.parameters, | ||
6829 | &def_parameters_CCK, size); | ||
6830 | else | ||
6831 | memcpy(&priv->assoc_network->qos_data.parameters, | ||
6832 | &def_parameters_OFDM, size); | ||
6833 | priv->assoc_network->qos_data.active = 0; | ||
6834 | priv->assoc_network->qos_data.supported = 0; | ||
6835 | set_qos_param = 1; | ||
6836 | } | ||
6837 | |||
6838 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
6839 | |||
6840 | if (set_qos_param == 1) | ||
6841 | schedule_work(&priv->qos_activate); | ||
6842 | |||
6843 | return ret; | ||
6844 | } | ||
6845 | |||
6846 | static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv) | ||
6847 | { | ||
6848 | u32 ret = 0; | ||
6849 | |||
6850 | if ((priv == NULL)) | ||
6851 | return 0; | ||
6852 | |||
6853 | if (!(priv->ieee->modulation & IEEE80211_OFDM_MODULATION)) | ||
6854 | ret = priv->qos_data.burst_duration_CCK; | ||
6855 | else | ||
6856 | ret = priv->qos_data.burst_duration_OFDM; | ||
6857 | |||
6858 | return ret; | ||
6859 | } | ||
6860 | |||
6861 | /* | ||
6862 | * Initialize the setting of QoS global | ||
6863 | */ | ||
6864 | static void ipw_qos_init(struct ipw_priv *priv, int enable, | ||
6865 | int burst_enable, u32 burst_duration_CCK, | ||
6866 | u32 burst_duration_OFDM) | ||
6867 | { | ||
6868 | priv->qos_data.qos_enable = enable; | ||
6869 | |||
6870 | if (priv->qos_data.qos_enable) { | ||
6871 | priv->qos_data.def_qos_parm_CCK = &def_qos_parameters_CCK; | ||
6872 | priv->qos_data.def_qos_parm_OFDM = &def_qos_parameters_OFDM; | ||
6873 | IPW_DEBUG_QOS("QoS is enabled\n"); | ||
6874 | } else { | ||
6875 | priv->qos_data.def_qos_parm_CCK = &def_parameters_CCK; | ||
6876 | priv->qos_data.def_qos_parm_OFDM = &def_parameters_OFDM; | ||
6877 | IPW_DEBUG_QOS("QoS is not enabled\n"); | ||
6878 | } | ||
6879 | |||
6880 | priv->qos_data.burst_enable = burst_enable; | ||
6881 | |||
6882 | if (burst_enable) { | ||
6883 | priv->qos_data.burst_duration_CCK = burst_duration_CCK; | ||
6884 | priv->qos_data.burst_duration_OFDM = burst_duration_OFDM; | ||
6885 | } else { | ||
6886 | priv->qos_data.burst_duration_CCK = 0; | ||
6887 | priv->qos_data.burst_duration_OFDM = 0; | ||
6888 | } | ||
6889 | } | ||
6890 | |||
6891 | /* | ||
6892 | * map the packet priority to the right TX Queue | ||
6893 | */ | ||
6894 | static int ipw_get_tx_queue_number(struct ipw_priv *priv, u16 priority) | ||
6895 | { | ||
6896 | if (priority > 7 || !priv->qos_data.qos_enable) | ||
6897 | priority = 0; | ||
6898 | |||
6899 | return from_priority_to_tx_queue[priority] - 1; | ||
6900 | } | ||
6901 | |||
6902 | /* | ||
6903 | * add QoS parameter to the TX command | ||
6904 | */ | ||
6905 | static int ipw_qos_set_tx_queue_command(struct ipw_priv *priv, | ||
6906 | u16 priority, | ||
6907 | struct tfd_data *tfd, u8 unicast) | ||
6908 | { | ||
6909 | int ret = 0; | ||
6910 | int tx_queue_id = 0; | ||
6911 | struct ieee80211_qos_data *qos_data = NULL; | ||
6912 | int active, supported; | ||
6913 | unsigned long flags; | ||
6914 | |||
6915 | if (!(priv->status & STATUS_ASSOCIATED)) | ||
6916 | return 0; | ||
6917 | |||
6918 | qos_data = &priv->assoc_network->qos_data; | ||
6919 | |||
6920 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
6921 | |||
6922 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | ||
6923 | if (unicast == 0) | ||
6924 | qos_data->active = 0; | ||
6925 | else | ||
6926 | qos_data->active = qos_data->supported; | ||
6927 | } | ||
6928 | |||
6929 | active = qos_data->active; | ||
6930 | supported = qos_data->supported; | ||
6931 | |||
6932 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
6933 | |||
6934 | IPW_DEBUG_QOS("QoS %d network is QoS active %d supported %d " | ||
6935 | "unicast %d\n", | ||
6936 | priv->qos_data.qos_enable, active, supported, unicast); | ||
6937 | if (active && priv->qos_data.qos_enable) { | ||
6938 | ret = from_priority_to_tx_queue[priority]; | ||
6939 | tx_queue_id = ret - 1; | ||
6940 | IPW_DEBUG_QOS("QoS packet priority is %d \n", priority); | ||
6941 | if (priority <= 7) { | ||
6942 | tfd->tx_flags_ext |= DCT_FLAG_EXT_QOS_ENABLED; | ||
6943 | tfd->tfd.tfd_26.mchdr.qos_ctrl = priority; | ||
6944 | tfd->tfd.tfd_26.mchdr.frame_ctl |= | ||
6945 | IEEE80211_STYPE_QOS_DATA; | ||
6946 | |||
6947 | if (priv->qos_data.qos_no_ack_mask & | ||
6948 | (1UL << tx_queue_id)) { | ||
6949 | tfd->tx_flags &= ~DCT_FLAG_ACK_REQD; | ||
6950 | tfd->tfd.tfd_26.mchdr.qos_ctrl |= | ||
6951 | CTRL_QOS_NO_ACK; | ||
6952 | } | ||
6953 | } | ||
6954 | } | ||
6955 | |||
6956 | return ret; | ||
6957 | } | ||
6958 | |||
6959 | /* | ||
6960 | * background support to run QoS activate functionality | ||
6961 | */ | ||
6962 | static void ipw_bg_qos_activate(void *data) | ||
6963 | { | ||
6964 | struct ipw_priv *priv = data; | ||
6965 | |||
6966 | if (priv == NULL) | ||
6967 | return; | ||
6968 | |||
6969 | down(&priv->sem); | ||
6970 | |||
6971 | if (priv->status & STATUS_ASSOCIATED) | ||
6972 | ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); | ||
6973 | |||
6974 | up(&priv->sem); | ||
6975 | } | ||
6976 | |||
6977 | static int ipw_handle_probe_response(struct net_device *dev, | ||
6978 | struct ieee80211_probe_response *resp, | ||
6979 | struct ieee80211_network *network) | ||
6980 | { | ||
6981 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6982 | int active_network = ((priv->status & STATUS_ASSOCIATED) && | ||
6983 | (network == priv->assoc_network)); | ||
6984 | |||
6985 | ipw_qos_handle_probe_response(priv, active_network, network); | ||
6986 | |||
6987 | return 0; | ||
6988 | } | ||
6989 | |||
6990 | static int ipw_handle_beacon(struct net_device *dev, | ||
6991 | struct ieee80211_beacon *resp, | ||
6992 | struct ieee80211_network *network) | ||
6993 | { | ||
6994 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6995 | int active_network = ((priv->status & STATUS_ASSOCIATED) && | ||
6996 | (network == priv->assoc_network)); | ||
6997 | |||
6998 | ipw_qos_handle_probe_response(priv, active_network, network); | ||
6999 | |||
7000 | return 0; | ||
7001 | } | ||
7002 | |||
7003 | static int ipw_handle_assoc_response(struct net_device *dev, | ||
7004 | struct ieee80211_assoc_response *resp, | ||
7005 | struct ieee80211_network *network) | ||
7006 | { | ||
7007 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
7008 | ipw_qos_association_resp(priv, network); | ||
7009 | return 0; | ||
7010 | } | ||
7011 | |||
7012 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters | ||
7013 | *qos_param) | ||
7014 | { | ||
7015 | struct host_cmd cmd = { | ||
7016 | .cmd = IPW_CMD_QOS_PARAMETERS, | ||
7017 | .len = (sizeof(struct ieee80211_qos_parameters) * 3) | ||
7018 | }; | ||
7019 | |||
7020 | memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3); | ||
7021 | return ipw_send_cmd(priv, &cmd); | ||
7022 | } | ||
7023 | |||
7024 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element | ||
7025 | *qos_param) | ||
7026 | { | ||
7027 | struct host_cmd cmd = { | ||
7028 | .cmd = IPW_CMD_WME_INFO, | ||
7029 | .len = sizeof(*qos_param) | ||
7030 | }; | ||
7031 | |||
7032 | memcpy(cmd.param, qos_param, sizeof(*qos_param)); | ||
7033 | return ipw_send_cmd(priv, &cmd); | ||
7034 | } | ||
7035 | |||
7036 | #endif /* CONFIG_IPW_QOS */ | ||
7037 | |||
4613 | static int ipw_associate_network(struct ipw_priv *priv, | 7038 | static int ipw_associate_network(struct ipw_priv *priv, |
4614 | struct ieee80211_network *network, | 7039 | struct ieee80211_network *network, |
4615 | struct ipw_supported_rates *rates, int roaming) | 7040 | struct ipw_supported_rates *rates, int roaming) |
@@ -4617,7 +7042,7 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4617 | int err; | 7042 | int err; |
4618 | 7043 | ||
4619 | if (priv->config & CFG_FIXED_RATE) | 7044 | if (priv->config & CFG_FIXED_RATE) |
4620 | ipw_set_fixed_rate(priv, network); | 7045 | ipw_set_fixed_rate(priv, network->mode); |
4621 | 7046 | ||
4622 | if (!(priv->config & CFG_STATIC_ESSID)) { | 7047 | if (!(priv->config & CFG_STATIC_ESSID)) { |
4623 | priv->essid_len = min(network->ssid_len, | 7048 | priv->essid_len = min(network->ssid_len, |
@@ -4632,14 +7057,22 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4632 | if ((priv->capability & CAP_PRIVACY_ON) && | 7057 | if ((priv->capability & CAP_PRIVACY_ON) && |
4633 | (priv->capability & CAP_SHARED_KEY)) { | 7058 | (priv->capability & CAP_SHARED_KEY)) { |
4634 | priv->assoc_request.auth_type = AUTH_SHARED_KEY; | 7059 | priv->assoc_request.auth_type = AUTH_SHARED_KEY; |
4635 | priv->assoc_request.auth_key = priv->sec.active_key; | 7060 | priv->assoc_request.auth_key = priv->ieee->sec.active_key; |
7061 | |||
7062 | if ((priv->capability & CAP_PRIVACY_ON) && | ||
7063 | (priv->ieee->sec.level == SEC_LEVEL_1) && | ||
7064 | !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) | ||
7065 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); | ||
4636 | } else { | 7066 | } else { |
4637 | priv->assoc_request.auth_type = AUTH_OPEN; | 7067 | priv->assoc_request.auth_type = AUTH_OPEN; |
4638 | priv->assoc_request.auth_key = 0; | 7068 | priv->assoc_request.auth_key = 0; |
4639 | } | 7069 | } |
4640 | 7070 | ||
4641 | if (priv->capability & CAP_PRIVACY_ON) | 7071 | if (priv->ieee->wpa_ie_len) { |
4642 | ipw_send_wep_keys(priv); | 7072 | priv->assoc_request.policy_support = 0x02; /* RSN active */ |
7073 | ipw_set_rsn_capa(priv, priv->ieee->wpa_ie, | ||
7074 | priv->ieee->wpa_ie_len); | ||
7075 | } | ||
4643 | 7076 | ||
4644 | /* | 7077 | /* |
4645 | * It is valid for our ieee device to support multiple modes, but | 7078 | * It is valid for our ieee device to support multiple modes, but |
@@ -4653,20 +7086,41 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4653 | else if (network->mode & priv->ieee->mode & IEEE_B) | 7086 | else if (network->mode & priv->ieee->mode & IEEE_B) |
4654 | priv->assoc_request.ieee_mode = IPW_B_MODE; | 7087 | priv->assoc_request.ieee_mode = IPW_B_MODE; |
4655 | 7088 | ||
7089 | priv->assoc_request.capability = network->capability; | ||
7090 | if ((network->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | ||
7091 | && !(priv->config & CFG_PREAMBLE_LONG)) { | ||
7092 | priv->assoc_request.preamble_length = DCT_FLAG_SHORT_PREAMBLE; | ||
7093 | } else { | ||
7094 | priv->assoc_request.preamble_length = DCT_FLAG_LONG_PREAMBLE; | ||
7095 | |||
7096 | /* Clear the short preamble if we won't be supporting it */ | ||
7097 | priv->assoc_request.capability &= | ||
7098 | ~WLAN_CAPABILITY_SHORT_PREAMBLE; | ||
7099 | } | ||
7100 | |||
7101 | /* Clear capability bits that aren't used in Ad Hoc */ | ||
7102 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | ||
7103 | priv->assoc_request.capability &= | ||
7104 | ~WLAN_CAPABILITY_SHORT_SLOT_TIME; | ||
7105 | |||
4656 | IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " | 7106 | IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " |
4657 | "802.11%c [%d], enc=%s%s%s%c%c\n", | 7107 | "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n", |
4658 | roaming ? "Rea" : "A", | 7108 | roaming ? "Rea" : "A", |
4659 | escape_essid(priv->essid, priv->essid_len), | 7109 | escape_essid(priv->essid, priv->essid_len), |
4660 | network->channel, | 7110 | network->channel, |
4661 | ipw_modes[priv->assoc_request.ieee_mode], | 7111 | ipw_modes[priv->assoc_request.ieee_mode], |
4662 | rates->num_rates, | 7112 | rates->num_rates, |
7113 | (priv->assoc_request.preamble_length == | ||
7114 | DCT_FLAG_LONG_PREAMBLE) ? "long" : "short", | ||
7115 | network->capability & | ||
7116 | WLAN_CAPABILITY_SHORT_PREAMBLE ? "short" : "long", | ||
4663 | priv->capability & CAP_PRIVACY_ON ? "on " : "off", | 7117 | priv->capability & CAP_PRIVACY_ON ? "on " : "off", |
4664 | priv->capability & CAP_PRIVACY_ON ? | 7118 | priv->capability & CAP_PRIVACY_ON ? |
4665 | (priv->capability & CAP_SHARED_KEY ? "(shared)" : | 7119 | (priv->capability & CAP_SHARED_KEY ? "(shared)" : |
4666 | "(open)") : "", | 7120 | "(open)") : "", |
4667 | priv->capability & CAP_PRIVACY_ON ? " key=" : "", | 7121 | priv->capability & CAP_PRIVACY_ON ? " key=" : "", |
4668 | priv->capability & CAP_PRIVACY_ON ? | 7122 | priv->capability & CAP_PRIVACY_ON ? |
4669 | '1' + priv->sec.active_key : '.', | 7123 | '1' + priv->ieee->sec.active_key : '.', |
4670 | priv->capability & CAP_PRIVACY_ON ? '.' : ' '); | 7124 | priv->capability & CAP_PRIVACY_ON ? '.' : ' '); |
4671 | 7125 | ||
4672 | priv->assoc_request.beacon_interval = network->beacon_interval; | 7126 | priv->assoc_request.beacon_interval = network->beacon_interval; |
@@ -4684,17 +7138,16 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4684 | priv->assoc_request.assoc_tsf_lsw = network->time_stamp[0]; | 7138 | priv->assoc_request.assoc_tsf_lsw = network->time_stamp[0]; |
4685 | } | 7139 | } |
4686 | 7140 | ||
4687 | memcpy(&priv->assoc_request.bssid, network->bssid, ETH_ALEN); | 7141 | memcpy(priv->assoc_request.bssid, network->bssid, ETH_ALEN); |
4688 | 7142 | ||
4689 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | 7143 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
4690 | memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); | 7144 | memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); |
4691 | priv->assoc_request.atim_window = network->atim_window; | 7145 | priv->assoc_request.atim_window = network->atim_window; |
4692 | } else { | 7146 | } else { |
4693 | memcpy(&priv->assoc_request.dest, network->bssid, ETH_ALEN); | 7147 | memcpy(priv->assoc_request.dest, network->bssid, ETH_ALEN); |
4694 | priv->assoc_request.atim_window = 0; | 7148 | priv->assoc_request.atim_window = 0; |
4695 | } | 7149 | } |
4696 | 7150 | ||
4697 | priv->assoc_request.capability = network->capability; | ||
4698 | priv->assoc_request.listen_interval = network->listen_interval; | 7151 | priv->assoc_request.listen_interval = network->listen_interval; |
4699 | 7152 | ||
4700 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); | 7153 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); |
@@ -4711,6 +7164,12 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4711 | priv->sys_config.dot11g_auto_detection = 1; | 7164 | priv->sys_config.dot11g_auto_detection = 1; |
4712 | else | 7165 | else |
4713 | priv->sys_config.dot11g_auto_detection = 0; | 7166 | priv->sys_config.dot11g_auto_detection = 0; |
7167 | |||
7168 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | ||
7169 | priv->sys_config.answer_broadcast_ssid_probe = 1; | ||
7170 | else | ||
7171 | priv->sys_config.answer_broadcast_ssid_probe = 0; | ||
7172 | |||
4714 | err = ipw_send_system_config(priv, &priv->sys_config); | 7173 | err = ipw_send_system_config(priv, &priv->sys_config); |
4715 | if (err) { | 7174 | if (err) { |
4716 | IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); | 7175 | IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); |
@@ -4718,7 +7177,7 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4718 | } | 7177 | } |
4719 | 7178 | ||
4720 | IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi); | 7179 | IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi); |
4721 | err = ipw_set_sensitivity(priv, network->stats.rssi); | 7180 | err = ipw_set_sensitivity(priv, network->stats.rssi + IPW_RSSI_TO_DBM); |
4722 | if (err) { | 7181 | if (err) { |
4723 | IPW_DEBUG_HC("Attempt to send associate command failed.\n"); | 7182 | IPW_DEBUG_HC("Attempt to send associate command failed.\n"); |
4724 | return err; | 7183 | return err; |
@@ -4736,6 +7195,10 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4736 | 7195 | ||
4737 | priv->assoc_network = network; | 7196 | priv->assoc_network = network; |
4738 | 7197 | ||
7198 | #ifdef CONFIG_IPW_QOS | ||
7199 | ipw_qos_association(priv, network); | ||
7200 | #endif | ||
7201 | |||
4739 | err = ipw_send_associate(priv, &priv->assoc_request); | 7202 | err = ipw_send_associate(priv, &priv->assoc_request); |
4740 | if (err) { | 7203 | if (err) { |
4741 | IPW_DEBUG_HC("Attempt to send associate command failed.\n"); | 7204 | IPW_DEBUG_HC("Attempt to send associate command failed.\n"); |
@@ -4783,12 +7246,15 @@ static void ipw_roam(void *data) | |||
4783 | if (priv->status & STATUS_ASSOCIATED) { | 7246 | if (priv->status & STATUS_ASSOCIATED) { |
4784 | /* First pass through ROAM process -- look for a better | 7247 | /* First pass through ROAM process -- look for a better |
4785 | * network */ | 7248 | * network */ |
7249 | unsigned long flags; | ||
4786 | u8 rssi = priv->assoc_network->stats.rssi; | 7250 | u8 rssi = priv->assoc_network->stats.rssi; |
4787 | priv->assoc_network->stats.rssi = -128; | 7251 | priv->assoc_network->stats.rssi = -128; |
7252 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
4788 | list_for_each_entry(network, &priv->ieee->network_list, list) { | 7253 | list_for_each_entry(network, &priv->ieee->network_list, list) { |
4789 | if (network != priv->assoc_network) | 7254 | if (network != priv->assoc_network) |
4790 | ipw_best_network(priv, &match, network, 1); | 7255 | ipw_best_network(priv, &match, network, 1); |
4791 | } | 7256 | } |
7257 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
4792 | priv->assoc_network->stats.rssi = rssi; | 7258 | priv->assoc_network->stats.rssi = rssi; |
4793 | 7259 | ||
4794 | if (match.network == priv->assoc_network) { | 7260 | if (match.network == priv->assoc_network) { |
@@ -4811,7 +7277,15 @@ static void ipw_roam(void *data) | |||
4811 | priv->status &= ~STATUS_ROAMING; | 7277 | priv->status &= ~STATUS_ROAMING; |
4812 | } | 7278 | } |
4813 | 7279 | ||
4814 | static void ipw_associate(void *data) | 7280 | static void ipw_bg_roam(void *data) |
7281 | { | ||
7282 | struct ipw_priv *priv = data; | ||
7283 | down(&priv->sem); | ||
7284 | ipw_roam(data); | ||
7285 | up(&priv->sem); | ||
7286 | } | ||
7287 | |||
7288 | static int ipw_associate(void *data) | ||
4815 | { | 7289 | { |
4816 | struct ipw_priv *priv = data; | 7290 | struct ipw_priv *priv = data; |
4817 | 7291 | ||
@@ -4821,14 +7295,41 @@ static void ipw_associate(void *data) | |||
4821 | }; | 7295 | }; |
4822 | struct ipw_supported_rates *rates; | 7296 | struct ipw_supported_rates *rates; |
4823 | struct list_head *element; | 7297 | struct list_head *element; |
7298 | unsigned long flags; | ||
7299 | |||
7300 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | ||
7301 | IPW_DEBUG_ASSOC("Not attempting association (monitor mode)\n"); | ||
7302 | return 0; | ||
7303 | } | ||
7304 | |||
7305 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | ||
7306 | IPW_DEBUG_ASSOC("Not attempting association (already in " | ||
7307 | "progress)\n"); | ||
7308 | return 0; | ||
7309 | } | ||
7310 | |||
7311 | if (priv->status & STATUS_DISASSOCIATING) { | ||
7312 | IPW_DEBUG_ASSOC("Not attempting association (in " | ||
7313 | "disassociating)\n "); | ||
7314 | queue_work(priv->workqueue, &priv->associate); | ||
7315 | return 0; | ||
7316 | } | ||
7317 | |||
7318 | if (!ipw_is_init(priv) || (priv->status & STATUS_SCANNING)) { | ||
7319 | IPW_DEBUG_ASSOC("Not attempting association (scanning or not " | ||
7320 | "initialized)\n"); | ||
7321 | return 0; | ||
7322 | } | ||
4824 | 7323 | ||
4825 | if (!(priv->config & CFG_ASSOCIATE) && | 7324 | if (!(priv->config & CFG_ASSOCIATE) && |
4826 | !(priv->config & (CFG_STATIC_ESSID | | 7325 | !(priv->config & (CFG_STATIC_ESSID | |
4827 | CFG_STATIC_CHANNEL | CFG_STATIC_BSSID))) { | 7326 | CFG_STATIC_CHANNEL | CFG_STATIC_BSSID))) { |
4828 | IPW_DEBUG_ASSOC("Not attempting association (associate=0)\n"); | 7327 | IPW_DEBUG_ASSOC("Not attempting association (associate=0)\n"); |
4829 | return; | 7328 | return 0; |
4830 | } | 7329 | } |
4831 | 7330 | ||
7331 | /* Protect our use of the network_list */ | ||
7332 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
4832 | list_for_each_entry(network, &priv->ieee->network_list, list) | 7333 | list_for_each_entry(network, &priv->ieee->network_list, list) |
4833 | ipw_best_network(priv, &match, network, 0); | 7334 | ipw_best_network(priv, &match, network, 0); |
4834 | 7335 | ||
@@ -4839,6 +7340,7 @@ static void ipw_associate(void *data) | |||
4839 | priv->ieee->iw_mode == IW_MODE_ADHOC && | 7340 | priv->ieee->iw_mode == IW_MODE_ADHOC && |
4840 | priv->config & CFG_ADHOC_CREATE && | 7341 | priv->config & CFG_ADHOC_CREATE && |
4841 | priv->config & CFG_STATIC_ESSID && | 7342 | priv->config & CFG_STATIC_ESSID && |
7343 | priv->config & CFG_STATIC_CHANNEL && | ||
4842 | !list_empty(&priv->ieee->network_free_list)) { | 7344 | !list_empty(&priv->ieee->network_free_list)) { |
4843 | element = priv->ieee->network_free_list.next; | 7345 | element = priv->ieee->network_free_list.next; |
4844 | network = list_entry(element, struct ieee80211_network, list); | 7346 | network = list_entry(element, struct ieee80211_network, list); |
@@ -4847,25 +7349,83 @@ static void ipw_associate(void *data) | |||
4847 | list_del(element); | 7349 | list_del(element); |
4848 | list_add_tail(&network->list, &priv->ieee->network_list); | 7350 | list_add_tail(&network->list, &priv->ieee->network_list); |
4849 | } | 7351 | } |
7352 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
4850 | 7353 | ||
4851 | /* If we reached the end of the list, then we don't have any valid | 7354 | /* If we reached the end of the list, then we don't have any valid |
4852 | * matching APs */ | 7355 | * matching APs */ |
4853 | if (!network) { | 7356 | if (!network) { |
4854 | ipw_debug_config(priv); | 7357 | ipw_debug_config(priv); |
4855 | 7358 | ||
4856 | queue_delayed_work(priv->workqueue, &priv->request_scan, | 7359 | if (!(priv->status & STATUS_SCANNING)) { |
4857 | SCAN_INTERVAL); | 7360 | if (!(priv->config & CFG_SPEED_SCAN)) |
7361 | queue_delayed_work(priv->workqueue, | ||
7362 | &priv->request_scan, | ||
7363 | SCAN_INTERVAL); | ||
7364 | else | ||
7365 | queue_work(priv->workqueue, | ||
7366 | &priv->request_scan); | ||
7367 | } | ||
4858 | 7368 | ||
4859 | return; | 7369 | return 0; |
4860 | } | 7370 | } |
4861 | 7371 | ||
4862 | ipw_associate_network(priv, network, rates, 0); | 7372 | ipw_associate_network(priv, network, rates, 0); |
7373 | |||
7374 | return 1; | ||
4863 | } | 7375 | } |
4864 | 7376 | ||
4865 | static inline void ipw_handle_data_packet(struct ipw_priv *priv, | 7377 | static void ipw_bg_associate(void *data) |
4866 | struct ipw_rx_mem_buffer *rxb, | ||
4867 | struct ieee80211_rx_stats *stats) | ||
4868 | { | 7378 | { |
7379 | struct ipw_priv *priv = data; | ||
7380 | down(&priv->sem); | ||
7381 | ipw_associate(data); | ||
7382 | up(&priv->sem); | ||
7383 | } | ||
7384 | |||
7385 | static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, | ||
7386 | struct sk_buff *skb) | ||
7387 | { | ||
7388 | struct ieee80211_hdr *hdr; | ||
7389 | u16 fc; | ||
7390 | |||
7391 | hdr = (struct ieee80211_hdr *)skb->data; | ||
7392 | fc = le16_to_cpu(hdr->frame_ctl); | ||
7393 | if (!(fc & IEEE80211_FCTL_PROTECTED)) | ||
7394 | return; | ||
7395 | |||
7396 | fc &= ~IEEE80211_FCTL_PROTECTED; | ||
7397 | hdr->frame_ctl = cpu_to_le16(fc); | ||
7398 | switch (priv->ieee->sec.level) { | ||
7399 | case SEC_LEVEL_3: | ||
7400 | /* Remove CCMP HDR */ | ||
7401 | memmove(skb->data + IEEE80211_3ADDR_LEN, | ||
7402 | skb->data + IEEE80211_3ADDR_LEN + 8, | ||
7403 | skb->len - IEEE80211_3ADDR_LEN - 8); | ||
7404 | skb_trim(skb, skb->len - 16); /* CCMP_HDR_LEN + CCMP_MIC_LEN */ | ||
7405 | break; | ||
7406 | case SEC_LEVEL_2: | ||
7407 | break; | ||
7408 | case SEC_LEVEL_1: | ||
7409 | /* Remove IV */ | ||
7410 | memmove(skb->data + IEEE80211_3ADDR_LEN, | ||
7411 | skb->data + IEEE80211_3ADDR_LEN + 4, | ||
7412 | skb->len - IEEE80211_3ADDR_LEN - 4); | ||
7413 | skb_trim(skb, skb->len - 8); /* IV + ICV */ | ||
7414 | break; | ||
7415 | case SEC_LEVEL_0: | ||
7416 | break; | ||
7417 | default: | ||
7418 | printk(KERN_ERR "Unknow security level %d\n", | ||
7419 | priv->ieee->sec.level); | ||
7420 | break; | ||
7421 | } | ||
7422 | } | ||
7423 | |||
7424 | static void ipw_handle_data_packet(struct ipw_priv *priv, | ||
7425 | struct ipw_rx_mem_buffer *rxb, | ||
7426 | struct ieee80211_rx_stats *stats) | ||
7427 | { | ||
7428 | struct ieee80211_hdr_4addr *hdr; | ||
4869 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; | 7429 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; |
4870 | 7430 | ||
4871 | /* We received data from the HW, so stop the watchdog */ | 7431 | /* We received data from the HW, so stop the watchdog */ |
@@ -4873,7 +7433,7 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, | |||
4873 | 7433 | ||
4874 | /* We only process data packets if the | 7434 | /* We only process data packets if the |
4875 | * interface is open */ | 7435 | * interface is open */ |
4876 | if (unlikely((pkt->u.frame.length + IPW_RX_FRAME_SIZE) > | 7436 | if (unlikely((le16_to_cpu(pkt->u.frame.length) + IPW_RX_FRAME_SIZE) > |
4877 | skb_tailroom(rxb->skb))) { | 7437 | skb_tailroom(rxb->skb))) { |
4878 | priv->ieee->stats.rx_errors++; | 7438 | priv->ieee->stats.rx_errors++; |
4879 | priv->wstats.discard.misc++; | 7439 | priv->wstats.discard.misc++; |
@@ -4890,14 +7450,351 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, | |||
4890 | skb_reserve(rxb->skb, offsetof(struct ipw_rx_packet, u.frame.data)); | 7450 | skb_reserve(rxb->skb, offsetof(struct ipw_rx_packet, u.frame.data)); |
4891 | 7451 | ||
4892 | /* Set the size of the skb to the size of the frame */ | 7452 | /* Set the size of the skb to the size of the frame */ |
4893 | skb_put(rxb->skb, pkt->u.frame.length); | 7453 | skb_put(rxb->skb, le16_to_cpu(pkt->u.frame.length)); |
4894 | 7454 | ||
4895 | IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); | 7455 | IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); |
4896 | 7456 | ||
7457 | /* HW decrypt will not clear the WEP bit, MIC, PN, etc. */ | ||
7458 | hdr = (struct ieee80211_hdr_4addr *)rxb->skb->data; | ||
7459 | if (priv->ieee->iw_mode != IW_MODE_MONITOR && | ||
7460 | ((is_multicast_ether_addr(hdr->addr1) || | ||
7461 | is_broadcast_ether_addr(hdr->addr1)) ? | ||
7462 | !priv->ieee->host_mc_decrypt : !priv->ieee->host_decrypt)) | ||
7463 | ipw_rebuild_decrypted_skb(priv, rxb->skb); | ||
7464 | |||
4897 | if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) | 7465 | if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) |
4898 | priv->ieee->stats.rx_errors++; | 7466 | priv->ieee->stats.rx_errors++; |
4899 | else /* ieee80211_rx succeeded, so it now owns the SKB */ | 7467 | else { /* ieee80211_rx succeeded, so it now owns the SKB */ |
4900 | rxb->skb = NULL; | 7468 | rxb->skb = NULL; |
7469 | __ipw_led_activity_on(priv); | ||
7470 | } | ||
7471 | } | ||
7472 | |||
7473 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
7474 | static void ipw_handle_data_packet_monitor(struct ipw_priv *priv, | ||
7475 | struct ipw_rx_mem_buffer *rxb, | ||
7476 | struct ieee80211_rx_stats *stats) | ||
7477 | { | ||
7478 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; | ||
7479 | struct ipw_rx_frame *frame = &pkt->u.frame; | ||
7480 | |||
7481 | /* initial pull of some data */ | ||
7482 | u16 received_channel = frame->received_channel; | ||
7483 | u8 antennaAndPhy = frame->antennaAndPhy; | ||
7484 | s8 antsignal = frame->rssi_dbm - IPW_RSSI_TO_DBM; /* call it signed anyhow */ | ||
7485 | u16 pktrate = frame->rate; | ||
7486 | |||
7487 | /* Magic struct that slots into the radiotap header -- no reason | ||
7488 | * to build this manually element by element, we can write it much | ||
7489 | * more efficiently than we can parse it. ORDER MATTERS HERE */ | ||
7490 | struct ipw_rt_hdr { | ||
7491 | struct ieee80211_radiotap_header rt_hdr; | ||
7492 | u8 rt_flags; /* radiotap packet flags */ | ||
7493 | u8 rt_rate; /* rate in 500kb/s */ | ||
7494 | u16 rt_channel; /* channel in mhz */ | ||
7495 | u16 rt_chbitmask; /* channel bitfield */ | ||
7496 | s8 rt_dbmsignal; /* signal in dbM, kluged to signed */ | ||
7497 | u8 rt_antenna; /* antenna number */ | ||
7498 | } *ipw_rt; | ||
7499 | |||
7500 | short len = le16_to_cpu(pkt->u.frame.length); | ||
7501 | |||
7502 | /* We received data from the HW, so stop the watchdog */ | ||
7503 | priv->net_dev->trans_start = jiffies; | ||
7504 | |||
7505 | /* We only process data packets if the | ||
7506 | * interface is open */ | ||
7507 | if (unlikely((le16_to_cpu(pkt->u.frame.length) + IPW_RX_FRAME_SIZE) > | ||
7508 | skb_tailroom(rxb->skb))) { | ||
7509 | priv->ieee->stats.rx_errors++; | ||
7510 | priv->wstats.discard.misc++; | ||
7511 | IPW_DEBUG_DROP("Corruption detected! Oh no!\n"); | ||
7512 | return; | ||
7513 | } else if (unlikely(!netif_running(priv->net_dev))) { | ||
7514 | priv->ieee->stats.rx_dropped++; | ||
7515 | priv->wstats.discard.misc++; | ||
7516 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); | ||
7517 | return; | ||
7518 | } | ||
7519 | |||
7520 | /* Libpcap 0.9.3+ can handle variable length radiotap, so we'll use | ||
7521 | * that now */ | ||
7522 | if (len > IPW_RX_BUF_SIZE - sizeof(struct ipw_rt_hdr)) { | ||
7523 | /* FIXME: Should alloc bigger skb instead */ | ||
7524 | priv->ieee->stats.rx_dropped++; | ||
7525 | priv->wstats.discard.misc++; | ||
7526 | IPW_DEBUG_DROP("Dropping too large packet in monitor\n"); | ||
7527 | return; | ||
7528 | } | ||
7529 | |||
7530 | /* copy the frame itself */ | ||
7531 | memmove(rxb->skb->data + sizeof(struct ipw_rt_hdr), | ||
7532 | rxb->skb->data + IPW_RX_FRAME_SIZE, len); | ||
7533 | |||
7534 | /* Zero the radiotap static buffer ... We only need to zero the bytes NOT | ||
7535 | * part of our real header, saves a little time. | ||
7536 | * | ||
7537 | * No longer necessary since we fill in all our data. Purge before merging | ||
7538 | * patch officially. | ||
7539 | * memset(rxb->skb->data + sizeof(struct ipw_rt_hdr), 0, | ||
7540 | * IEEE80211_RADIOTAP_HDRLEN - sizeof(struct ipw_rt_hdr)); | ||
7541 | */ | ||
7542 | |||
7543 | ipw_rt = (struct ipw_rt_hdr *)rxb->skb->data; | ||
7544 | |||
7545 | ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; | ||
7546 | ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ | ||
7547 | ipw_rt->rt_hdr.it_len = sizeof(struct ipw_rt_hdr); /* total header+data */ | ||
7548 | |||
7549 | /* Big bitfield of all the fields we provide in radiotap */ | ||
7550 | ipw_rt->rt_hdr.it_present = | ||
7551 | ((1 << IEEE80211_RADIOTAP_FLAGS) | | ||
7552 | (1 << IEEE80211_RADIOTAP_RATE) | | ||
7553 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | ||
7554 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | | ||
7555 | (1 << IEEE80211_RADIOTAP_ANTENNA)); | ||
7556 | |||
7557 | /* Zero the flags, we'll add to them as we go */ | ||
7558 | ipw_rt->rt_flags = 0; | ||
7559 | |||
7560 | /* Convert signal to DBM */ | ||
7561 | ipw_rt->rt_dbmsignal = antsignal; | ||
7562 | |||
7563 | /* Convert the channel data and set the flags */ | ||
7564 | ipw_rt->rt_channel = cpu_to_le16(ieee80211chan2mhz(received_channel)); | ||
7565 | if (received_channel > 14) { /* 802.11a */ | ||
7566 | ipw_rt->rt_chbitmask = | ||
7567 | cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); | ||
7568 | } else if (antennaAndPhy & 32) { /* 802.11b */ | ||
7569 | ipw_rt->rt_chbitmask = | ||
7570 | cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); | ||
7571 | } else { /* 802.11g */ | ||
7572 | ipw_rt->rt_chbitmask = | ||
7573 | (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ); | ||
7574 | } | ||
7575 | |||
7576 | /* set the rate in multiples of 500k/s */ | ||
7577 | switch (pktrate) { | ||
7578 | case IPW_TX_RATE_1MB: | ||
7579 | ipw_rt->rt_rate = 2; | ||
7580 | break; | ||
7581 | case IPW_TX_RATE_2MB: | ||
7582 | ipw_rt->rt_rate = 4; | ||
7583 | break; | ||
7584 | case IPW_TX_RATE_5MB: | ||
7585 | ipw_rt->rt_rate = 10; | ||
7586 | break; | ||
7587 | case IPW_TX_RATE_6MB: | ||
7588 | ipw_rt->rt_rate = 12; | ||
7589 | break; | ||
7590 | case IPW_TX_RATE_9MB: | ||
7591 | ipw_rt->rt_rate = 18; | ||
7592 | break; | ||
7593 | case IPW_TX_RATE_11MB: | ||
7594 | ipw_rt->rt_rate = 22; | ||
7595 | break; | ||
7596 | case IPW_TX_RATE_12MB: | ||
7597 | ipw_rt->rt_rate = 24; | ||
7598 | break; | ||
7599 | case IPW_TX_RATE_18MB: | ||
7600 | ipw_rt->rt_rate = 36; | ||
7601 | break; | ||
7602 | case IPW_TX_RATE_24MB: | ||
7603 | ipw_rt->rt_rate = 48; | ||
7604 | break; | ||
7605 | case IPW_TX_RATE_36MB: | ||
7606 | ipw_rt->rt_rate = 72; | ||
7607 | break; | ||
7608 | case IPW_TX_RATE_48MB: | ||
7609 | ipw_rt->rt_rate = 96; | ||
7610 | break; | ||
7611 | case IPW_TX_RATE_54MB: | ||
7612 | ipw_rt->rt_rate = 108; | ||
7613 | break; | ||
7614 | default: | ||
7615 | ipw_rt->rt_rate = 0; | ||
7616 | break; | ||
7617 | } | ||
7618 | |||
7619 | /* antenna number */ | ||
7620 | ipw_rt->rt_antenna = (antennaAndPhy & 3); /* Is this right? */ | ||
7621 | |||
7622 | /* set the preamble flag if we have it */ | ||
7623 | if ((antennaAndPhy & 64)) | ||
7624 | ipw_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; | ||
7625 | |||
7626 | /* Set the size of the skb to the size of the frame */ | ||
7627 | skb_put(rxb->skb, len + sizeof(struct ipw_rt_hdr)); | ||
7628 | |||
7629 | IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); | ||
7630 | |||
7631 | if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) | ||
7632 | priv->ieee->stats.rx_errors++; | ||
7633 | else { /* ieee80211_rx succeeded, so it now owns the SKB */ | ||
7634 | rxb->skb = NULL; | ||
7635 | /* no LED during capture */ | ||
7636 | } | ||
7637 | } | ||
7638 | #endif | ||
7639 | |||
7640 | static inline int is_network_packet(struct ipw_priv *priv, | ||
7641 | struct ieee80211_hdr_4addr *header) | ||
7642 | { | ||
7643 | /* Filter incoming packets to determine if they are targetted toward | ||
7644 | * this network, discarding packets coming from ourselves */ | ||
7645 | switch (priv->ieee->iw_mode) { | ||
7646 | case IW_MODE_ADHOC: /* Header: Dest. | Source | BSSID */ | ||
7647 | /* packets from our adapter are dropped (echo) */ | ||
7648 | if (!memcmp(header->addr2, priv->net_dev->dev_addr, ETH_ALEN)) | ||
7649 | return 0; | ||
7650 | |||
7651 | /* {broad,multi}cast packets to our BSSID go through */ | ||
7652 | if (is_multicast_ether_addr(header->addr1) || | ||
7653 | is_broadcast_ether_addr(header->addr1)) | ||
7654 | return !memcmp(header->addr3, priv->bssid, ETH_ALEN); | ||
7655 | |||
7656 | /* packets to our adapter go through */ | ||
7657 | return !memcmp(header->addr1, priv->net_dev->dev_addr, | ||
7658 | ETH_ALEN); | ||
7659 | |||
7660 | case IW_MODE_INFRA: /* Header: Dest. | BSSID | Source */ | ||
7661 | /* packets from our adapter are dropped (echo) */ | ||
7662 | if (!memcmp(header->addr3, priv->net_dev->dev_addr, ETH_ALEN)) | ||
7663 | return 0; | ||
7664 | |||
7665 | /* {broad,multi}cast packets to our BSS go through */ | ||
7666 | if (is_multicast_ether_addr(header->addr1) || | ||
7667 | is_broadcast_ether_addr(header->addr1)) | ||
7668 | return !memcmp(header->addr2, priv->bssid, ETH_ALEN); | ||
7669 | |||
7670 | /* packets to our adapter go through */ | ||
7671 | return !memcmp(header->addr1, priv->net_dev->dev_addr, | ||
7672 | ETH_ALEN); | ||
7673 | } | ||
7674 | |||
7675 | return 1; | ||
7676 | } | ||
7677 | |||
7678 | #define IPW_PACKET_RETRY_TIME HZ | ||
7679 | |||
7680 | static inline int is_duplicate_packet(struct ipw_priv *priv, | ||
7681 | struct ieee80211_hdr_4addr *header) | ||
7682 | { | ||
7683 | u16 sc = le16_to_cpu(header->seq_ctl); | ||
7684 | u16 seq = WLAN_GET_SEQ_SEQ(sc); | ||
7685 | u16 frag = WLAN_GET_SEQ_FRAG(sc); | ||
7686 | u16 *last_seq, *last_frag; | ||
7687 | unsigned long *last_time; | ||
7688 | |||
7689 | switch (priv->ieee->iw_mode) { | ||
7690 | case IW_MODE_ADHOC: | ||
7691 | { | ||
7692 | struct list_head *p; | ||
7693 | struct ipw_ibss_seq *entry = NULL; | ||
7694 | u8 *mac = header->addr2; | ||
7695 | int index = mac[5] % IPW_IBSS_MAC_HASH_SIZE; | ||
7696 | |||
7697 | __list_for_each(p, &priv->ibss_mac_hash[index]) { | ||
7698 | entry = | ||
7699 | list_entry(p, struct ipw_ibss_seq, list); | ||
7700 | if (!memcmp(entry->mac, mac, ETH_ALEN)) | ||
7701 | break; | ||
7702 | } | ||
7703 | if (p == &priv->ibss_mac_hash[index]) { | ||
7704 | entry = kmalloc(sizeof(*entry), GFP_ATOMIC); | ||
7705 | if (!entry) { | ||
7706 | IPW_ERROR | ||
7707 | ("Cannot malloc new mac entry\n"); | ||
7708 | return 0; | ||
7709 | } | ||
7710 | memcpy(entry->mac, mac, ETH_ALEN); | ||
7711 | entry->seq_num = seq; | ||
7712 | entry->frag_num = frag; | ||
7713 | entry->packet_time = jiffies; | ||
7714 | list_add(&entry->list, | ||
7715 | &priv->ibss_mac_hash[index]); | ||
7716 | return 0; | ||
7717 | } | ||
7718 | last_seq = &entry->seq_num; | ||
7719 | last_frag = &entry->frag_num; | ||
7720 | last_time = &entry->packet_time; | ||
7721 | break; | ||
7722 | } | ||
7723 | case IW_MODE_INFRA: | ||
7724 | last_seq = &priv->last_seq_num; | ||
7725 | last_frag = &priv->last_frag_num; | ||
7726 | last_time = &priv->last_packet_time; | ||
7727 | break; | ||
7728 | default: | ||
7729 | return 0; | ||
7730 | } | ||
7731 | if ((*last_seq == seq) && | ||
7732 | time_after(*last_time + IPW_PACKET_RETRY_TIME, jiffies)) { | ||
7733 | if (*last_frag == frag) | ||
7734 | goto drop; | ||
7735 | if (*last_frag + 1 != frag) | ||
7736 | /* out-of-order fragment */ | ||
7737 | goto drop; | ||
7738 | } else | ||
7739 | *last_seq = seq; | ||
7740 | |||
7741 | *last_frag = frag; | ||
7742 | *last_time = jiffies; | ||
7743 | return 0; | ||
7744 | |||
7745 | drop: | ||
7746 | /* Comment this line now since we observed the card receives | ||
7747 | * duplicate packets but the FCTL_RETRY bit is not set in the | ||
7748 | * IBSS mode with fragmentation enabled. | ||
7749 | BUG_ON(!(le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_RETRY)); */ | ||
7750 | return 1; | ||
7751 | } | ||
7752 | |||
7753 | static void ipw_handle_mgmt_packet(struct ipw_priv *priv, | ||
7754 | struct ipw_rx_mem_buffer *rxb, | ||
7755 | struct ieee80211_rx_stats *stats) | ||
7756 | { | ||
7757 | struct sk_buff *skb = rxb->skb; | ||
7758 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)skb->data; | ||
7759 | struct ieee80211_hdr_4addr *header = (struct ieee80211_hdr_4addr *) | ||
7760 | (skb->data + IPW_RX_FRAME_SIZE); | ||
7761 | |||
7762 | ieee80211_rx_mgt(priv->ieee, header, stats); | ||
7763 | |||
7764 | if (priv->ieee->iw_mode == IW_MODE_ADHOC && | ||
7765 | ((WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) == | ||
7766 | IEEE80211_STYPE_PROBE_RESP) || | ||
7767 | (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) == | ||
7768 | IEEE80211_STYPE_BEACON))) { | ||
7769 | if (!memcmp(header->addr3, priv->bssid, ETH_ALEN)) | ||
7770 | ipw_add_station(priv, header->addr2); | ||
7771 | } | ||
7772 | |||
7773 | if (priv->config & CFG_NET_STATS) { | ||
7774 | IPW_DEBUG_HC("sending stat packet\n"); | ||
7775 | |||
7776 | /* Set the size of the skb to the size of the full | ||
7777 | * ipw header and 802.11 frame */ | ||
7778 | skb_put(skb, le16_to_cpu(pkt->u.frame.length) + | ||
7779 | IPW_RX_FRAME_SIZE); | ||
7780 | |||
7781 | /* Advance past the ipw packet header to the 802.11 frame */ | ||
7782 | skb_pull(skb, IPW_RX_FRAME_SIZE); | ||
7783 | |||
7784 | /* Push the ieee80211_rx_stats before the 802.11 frame */ | ||
7785 | memcpy(skb_push(skb, sizeof(*stats)), stats, sizeof(*stats)); | ||
7786 | |||
7787 | skb->dev = priv->ieee->dev; | ||
7788 | |||
7789 | /* Point raw at the ieee80211_stats */ | ||
7790 | skb->mac.raw = skb->data; | ||
7791 | |||
7792 | skb->pkt_type = PACKET_OTHERHOST; | ||
7793 | skb->protocol = __constant_htons(ETH_P_80211_STATS); | ||
7794 | memset(skb->cb, 0, sizeof(rxb->skb->cb)); | ||
7795 | netif_rx(skb); | ||
7796 | rxb->skb = NULL; | ||
7797 | } | ||
4901 | } | 7798 | } |
4902 | 7799 | ||
4903 | /* | 7800 | /* |
@@ -4913,8 +7810,8 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4913 | u32 r, w, i; | 7810 | u32 r, w, i; |
4914 | u8 network_packet; | 7811 | u8 network_packet; |
4915 | 7812 | ||
4916 | r = ipw_read32(priv, CX2_RX_READ_INDEX); | 7813 | r = ipw_read32(priv, IPW_RX_READ_INDEX); |
4917 | w = ipw_read32(priv, CX2_RX_WRITE_INDEX); | 7814 | w = ipw_read32(priv, IPW_RX_WRITE_INDEX); |
4918 | i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE; | 7815 | i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE; |
4919 | 7816 | ||
4920 | while (i != r) { | 7817 | while (i != r) { |
@@ -4928,7 +7825,7 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4928 | priv->rxq->queue[i] = NULL; | 7825 | priv->rxq->queue[i] = NULL; |
4929 | 7826 | ||
4930 | pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, | 7827 | pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, |
4931 | CX2_RX_BUF_SIZE, | 7828 | IPW_RX_BUF_SIZE, |
4932 | PCI_DMA_FROMDEVICE); | 7829 | PCI_DMA_FROMDEVICE); |
4933 | 7830 | ||
4934 | pkt = (struct ipw_rx_packet *)rxb->skb->data; | 7831 | pkt = (struct ipw_rx_packet *)rxb->skb->data; |
@@ -4939,9 +7836,13 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4939 | switch (pkt->header.message_type) { | 7836 | switch (pkt->header.message_type) { |
4940 | case RX_FRAME_TYPE: /* 802.11 frame */ { | 7837 | case RX_FRAME_TYPE: /* 802.11 frame */ { |
4941 | struct ieee80211_rx_stats stats = { | 7838 | struct ieee80211_rx_stats stats = { |
4942 | .rssi = pkt->u.frame.rssi_dbm - | 7839 | .rssi = |
7840 | le16_to_cpu(pkt->u.frame.rssi_dbm) - | ||
4943 | IPW_RSSI_TO_DBM, | 7841 | IPW_RSSI_TO_DBM, |
4944 | .signal = pkt->u.frame.signal, | 7842 | .signal = |
7843 | le16_to_cpu(pkt->u.frame.signal), | ||
7844 | .noise = | ||
7845 | le16_to_cpu(pkt->u.frame.noise), | ||
4945 | .rate = pkt->u.frame.rate, | 7846 | .rate = pkt->u.frame.rate, |
4946 | .mac_time = jiffies, | 7847 | .mac_time = jiffies, |
4947 | .received_channel = | 7848 | .received_channel = |
@@ -4951,22 +7852,30 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4951 | control & (1 << 0)) ? | 7852 | control & (1 << 0)) ? |
4952 | IEEE80211_24GHZ_BAND : | 7853 | IEEE80211_24GHZ_BAND : |
4953 | IEEE80211_52GHZ_BAND, | 7854 | IEEE80211_52GHZ_BAND, |
4954 | .len = pkt->u.frame.length, | 7855 | .len = le16_to_cpu(pkt->u.frame.length), |
4955 | }; | 7856 | }; |
4956 | 7857 | ||
4957 | if (stats.rssi != 0) | 7858 | if (stats.rssi != 0) |
4958 | stats.mask |= IEEE80211_STATMASK_RSSI; | 7859 | stats.mask |= IEEE80211_STATMASK_RSSI; |
4959 | if (stats.signal != 0) | 7860 | if (stats.signal != 0) |
4960 | stats.mask |= IEEE80211_STATMASK_SIGNAL; | 7861 | stats.mask |= IEEE80211_STATMASK_SIGNAL; |
7862 | if (stats.noise != 0) | ||
7863 | stats.mask |= IEEE80211_STATMASK_NOISE; | ||
4961 | if (stats.rate != 0) | 7864 | if (stats.rate != 0) |
4962 | stats.mask |= IEEE80211_STATMASK_RATE; | 7865 | stats.mask |= IEEE80211_STATMASK_RATE; |
4963 | 7866 | ||
4964 | priv->rx_packets++; | 7867 | priv->rx_packets++; |
4965 | 7868 | ||
4966 | #ifdef CONFIG_IPW_PROMISC | 7869 | #ifdef CONFIG_IPW2200_MONITOR |
4967 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | 7870 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { |
7871 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
7872 | ipw_handle_data_packet_monitor(priv, | ||
7873 | rxb, | ||
7874 | &stats); | ||
7875 | #else | ||
4968 | ipw_handle_data_packet(priv, rxb, | 7876 | ipw_handle_data_packet(priv, rxb, |
4969 | &stats); | 7877 | &stats); |
7878 | #endif | ||
4970 | break; | 7879 | break; |
4971 | } | 7880 | } |
4972 | #endif | 7881 | #endif |
@@ -4980,35 +7889,9 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4980 | * correctly -- we should probably use the | 7889 | * correctly -- we should probably use the |
4981 | * frame control of the packet and disregard | 7890 | * frame control of the packet and disregard |
4982 | * the current iw_mode */ | 7891 | * the current iw_mode */ |
4983 | switch (priv->ieee->iw_mode) { | ||
4984 | case IW_MODE_ADHOC: | ||
4985 | network_packet = | ||
4986 | !memcmp(header->addr1, | ||
4987 | priv->net_dev->dev_addr, | ||
4988 | ETH_ALEN) || | ||
4989 | !memcmp(header->addr3, | ||
4990 | priv->bssid, ETH_ALEN) || | ||
4991 | is_broadcast_ether_addr(header-> | ||
4992 | addr1) | ||
4993 | || is_multicast_ether_addr(header-> | ||
4994 | addr1); | ||
4995 | break; | ||
4996 | |||
4997 | case IW_MODE_INFRA: | ||
4998 | default: | ||
4999 | network_packet = | ||
5000 | !memcmp(header->addr3, | ||
5001 | priv->bssid, ETH_ALEN) || | ||
5002 | !memcmp(header->addr1, | ||
5003 | priv->net_dev->dev_addr, | ||
5004 | ETH_ALEN) || | ||
5005 | is_broadcast_ether_addr(header-> | ||
5006 | addr1) | ||
5007 | || is_multicast_ether_addr(header-> | ||
5008 | addr1); | ||
5009 | break; | ||
5010 | } | ||
5011 | 7892 | ||
7893 | network_packet = | ||
7894 | is_network_packet(priv, header); | ||
5012 | if (network_packet && priv->assoc_network) { | 7895 | if (network_packet && priv->assoc_network) { |
5013 | priv->assoc_network->stats.rssi = | 7896 | priv->assoc_network->stats.rssi = |
5014 | stats.rssi; | 7897 | stats.rssi; |
@@ -5018,9 +7901,10 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5018 | } | 7901 | } |
5019 | 7902 | ||
5020 | IPW_DEBUG_RX("Frame: len=%u\n", | 7903 | IPW_DEBUG_RX("Frame: len=%u\n", |
5021 | pkt->u.frame.length); | 7904 | le16_to_cpu(pkt->u.frame.length)); |
5022 | 7905 | ||
5023 | if (pkt->u.frame.length < frame_hdr_len(header)) { | 7906 | if (le16_to_cpu(pkt->u.frame.length) < |
7907 | frame_hdr_len(header)) { | ||
5024 | IPW_DEBUG_DROP | 7908 | IPW_DEBUG_DROP |
5025 | ("Received packet is too small. " | 7909 | ("Received packet is too small. " |
5026 | "Dropping.\n"); | 7910 | "Dropping.\n"); |
@@ -5029,34 +7913,22 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5029 | break; | 7913 | break; |
5030 | } | 7914 | } |
5031 | 7915 | ||
5032 | switch (WLAN_FC_GET_TYPE(header->frame_ctl)) { | 7916 | switch (WLAN_FC_GET_TYPE |
7917 | (le16_to_cpu(header->frame_ctl))) { | ||
7918 | |||
5033 | case IEEE80211_FTYPE_MGMT: | 7919 | case IEEE80211_FTYPE_MGMT: |
5034 | ieee80211_rx_mgt(priv->ieee, header, | 7920 | ipw_handle_mgmt_packet(priv, rxb, |
5035 | &stats); | 7921 | &stats); |
5036 | if (priv->ieee->iw_mode == IW_MODE_ADHOC | ||
5037 | && | ||
5038 | ((WLAN_FC_GET_STYPE | ||
5039 | (header->frame_ctl) == | ||
5040 | IEEE80211_STYPE_PROBE_RESP) | ||
5041 | || | ||
5042 | (WLAN_FC_GET_STYPE | ||
5043 | (header->frame_ctl) == | ||
5044 | IEEE80211_STYPE_BEACON)) | ||
5045 | && !memcmp(header->addr3, | ||
5046 | priv->bssid, ETH_ALEN)) | ||
5047 | ipw_add_station(priv, | ||
5048 | header->addr2); | ||
5049 | break; | 7922 | break; |
5050 | 7923 | ||
5051 | case IEEE80211_FTYPE_CTL: | 7924 | case IEEE80211_FTYPE_CTL: |
5052 | break; | 7925 | break; |
5053 | 7926 | ||
5054 | case IEEE80211_FTYPE_DATA: | 7927 | case IEEE80211_FTYPE_DATA: |
5055 | if (network_packet) | 7928 | if (unlikely(!network_packet || |
5056 | ipw_handle_data_packet(priv, | 7929 | is_duplicate_packet(priv, |
5057 | rxb, | 7930 | header))) |
5058 | &stats); | 7931 | { |
5059 | else | ||
5060 | IPW_DEBUG_DROP("Dropping: " | 7932 | IPW_DEBUG_DROP("Dropping: " |
5061 | MAC_FMT ", " | 7933 | MAC_FMT ", " |
5062 | MAC_FMT ", " | 7934 | MAC_FMT ", " |
@@ -5067,6 +7939,12 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5067 | addr2), | 7939 | addr2), |
5068 | MAC_ARG(header-> | 7940 | MAC_ARG(header-> |
5069 | addr3)); | 7941 | addr3)); |
7942 | break; | ||
7943 | } | ||
7944 | |||
7945 | ipw_handle_data_packet(priv, rxb, | ||
7946 | &stats); | ||
7947 | |||
5070 | break; | 7948 | break; |
5071 | } | 7949 | } |
5072 | break; | 7950 | break; |
@@ -5097,7 +7975,7 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5097 | } | 7975 | } |
5098 | 7976 | ||
5099 | pci_unmap_single(priv->pci_dev, rxb->dma_addr, | 7977 | pci_unmap_single(priv->pci_dev, rxb->dma_addr, |
5100 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 7978 | IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
5101 | list_add_tail(&rxb->list, &priv->rxq->rx_used); | 7979 | list_add_tail(&rxb->list, &priv->rxq->rx_used); |
5102 | 7980 | ||
5103 | i = (i + 1) % RX_QUEUE_SIZE; | 7981 | i = (i + 1) % RX_QUEUE_SIZE; |
@@ -5109,128 +7987,129 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5109 | ipw_rx_queue_restock(priv); | 7987 | ipw_rx_queue_restock(priv); |
5110 | } | 7988 | } |
5111 | 7989 | ||
5112 | static void ipw_abort_scan(struct ipw_priv *priv) | 7990 | #define DEFAULT_RTS_THRESHOLD 2304U |
7991 | #define MIN_RTS_THRESHOLD 1U | ||
7992 | #define MAX_RTS_THRESHOLD 2304U | ||
7993 | #define DEFAULT_BEACON_INTERVAL 100U | ||
7994 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | ||
7995 | #define DEFAULT_LONG_RETRY_LIMIT 4U | ||
7996 | |||
7997 | static int ipw_sw_reset(struct ipw_priv *priv, int init) | ||
5113 | { | 7998 | { |
5114 | int err; | 7999 | int band, modulation; |
8000 | int old_mode = priv->ieee->iw_mode; | ||
5115 | 8001 | ||
5116 | if (priv->status & STATUS_SCAN_ABORTING) { | 8002 | /* Initialize module parameter values here */ |
5117 | IPW_DEBUG_HC("Ignoring concurrent scan abort request.\n"); | 8003 | priv->config = 0; |
5118 | return; | ||
5119 | } | ||
5120 | priv->status |= STATUS_SCAN_ABORTING; | ||
5121 | 8004 | ||
5122 | err = ipw_send_scan_abort(priv); | 8005 | /* We default to disabling the LED code as right now it causes |
5123 | if (err) | 8006 | * too many systems to lock up... */ |
5124 | IPW_DEBUG_HC("Request to abort scan failed.\n"); | 8007 | if (!led) |
5125 | } | 8008 | priv->config |= CFG_NO_LED; |
5126 | 8009 | ||
5127 | static int ipw_request_scan(struct ipw_priv *priv) | 8010 | if (associate) |
5128 | { | 8011 | priv->config |= CFG_ASSOCIATE; |
5129 | struct ipw_scan_request_ext scan; | 8012 | else |
5130 | int channel_index = 0; | 8013 | IPW_DEBUG_INFO("Auto associate disabled.\n"); |
5131 | int i, err, scan_type; | ||
5132 | 8014 | ||
5133 | if (priv->status & STATUS_EXIT_PENDING) { | 8015 | if (auto_create) |
5134 | IPW_DEBUG_SCAN("Aborting scan due to device shutdown\n"); | 8016 | priv->config |= CFG_ADHOC_CREATE; |
5135 | priv->status |= STATUS_SCAN_PENDING; | 8017 | else |
5136 | return 0; | 8018 | IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); |
5137 | } | ||
5138 | 8019 | ||
5139 | if (priv->status & STATUS_SCANNING) { | 8020 | if (disable) { |
5140 | IPW_DEBUG_HC("Concurrent scan requested. Aborting first.\n"); | 8021 | priv->status |= STATUS_RF_KILL_SW; |
5141 | priv->status |= STATUS_SCAN_PENDING; | 8022 | IPW_DEBUG_INFO("Radio disabled.\n"); |
5142 | ipw_abort_scan(priv); | ||
5143 | return 0; | ||
5144 | } | 8023 | } |
5145 | 8024 | ||
5146 | if (priv->status & STATUS_SCAN_ABORTING) { | 8025 | if (channel != 0) { |
5147 | IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); | 8026 | priv->config |= CFG_STATIC_CHANNEL; |
5148 | priv->status |= STATUS_SCAN_PENDING; | 8027 | priv->channel = channel; |
5149 | return 0; | 8028 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); |
8029 | /* TODO: Validate that provided channel is in range */ | ||
5150 | } | 8030 | } |
8031 | #ifdef CONFIG_IPW_QOS | ||
8032 | ipw_qos_init(priv, qos_enable, qos_burst_enable, | ||
8033 | burst_duration_CCK, burst_duration_OFDM); | ||
8034 | #endif /* CONFIG_IPW_QOS */ | ||
5151 | 8035 | ||
5152 | if (priv->status & STATUS_RF_KILL_MASK) { | 8036 | switch (mode) { |
5153 | IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); | 8037 | case 1: |
5154 | priv->status |= STATUS_SCAN_PENDING; | 8038 | priv->ieee->iw_mode = IW_MODE_ADHOC; |
5155 | return 0; | 8039 | priv->net_dev->type = ARPHRD_ETHER; |
8040 | |||
8041 | break; | ||
8042 | #ifdef CONFIG_IPW2200_MONITOR | ||
8043 | case 2: | ||
8044 | priv->ieee->iw_mode = IW_MODE_MONITOR; | ||
8045 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
8046 | priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
8047 | #else | ||
8048 | priv->net_dev->type = ARPHRD_IEEE80211; | ||
8049 | #endif | ||
8050 | break; | ||
8051 | #endif | ||
8052 | default: | ||
8053 | case 0: | ||
8054 | priv->net_dev->type = ARPHRD_ETHER; | ||
8055 | priv->ieee->iw_mode = IW_MODE_INFRA; | ||
8056 | break; | ||
5156 | } | 8057 | } |
5157 | 8058 | ||
5158 | memset(&scan, 0, sizeof(scan)); | 8059 | if (hwcrypto) { |
8060 | priv->ieee->host_encrypt = 0; | ||
8061 | priv->ieee->host_encrypt_msdu = 0; | ||
8062 | priv->ieee->host_decrypt = 0; | ||
8063 | priv->ieee->host_mc_decrypt = 0; | ||
8064 | } | ||
8065 | IPW_DEBUG_INFO("Hardware crypto [%s]\n", hwcrypto ? "on" : "off"); | ||
5159 | 8066 | ||
5160 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = 20; | 8067 | /* IPW2200/2915 is abled to do hardware fragmentation. */ |
5161 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = 20; | 8068 | priv->ieee->host_open_frag = 0; |
5162 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = 20; | ||
5163 | |||
5164 | scan.full_scan_index = ieee80211_get_scans(priv->ieee); | ||
5165 | /* If we are roaming, then make this a directed scan for the current | ||
5166 | * network. Otherwise, ensure that every other scan is a fast | ||
5167 | * channel hop scan */ | ||
5168 | if ((priv->status & STATUS_ROAMING) | ||
5169 | || (!(priv->status & STATUS_ASSOCIATED) | ||
5170 | && (priv->config & CFG_STATIC_ESSID) | ||
5171 | && (scan.full_scan_index % 2))) { | ||
5172 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); | ||
5173 | if (err) { | ||
5174 | IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); | ||
5175 | return err; | ||
5176 | } | ||
5177 | 8069 | ||
5178 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; | 8070 | if ((priv->pci_dev->device == 0x4223) || |
8071 | (priv->pci_dev->device == 0x4224)) { | ||
8072 | if (init) | ||
8073 | printk(KERN_INFO DRV_NAME | ||
8074 | ": Detected Intel PRO/Wireless 2915ABG Network " | ||
8075 | "Connection\n"); | ||
8076 | priv->ieee->abg_true = 1; | ||
8077 | band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; | ||
8078 | modulation = IEEE80211_OFDM_MODULATION | | ||
8079 | IEEE80211_CCK_MODULATION; | ||
8080 | priv->adapter = IPW_2915ABG; | ||
8081 | priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; | ||
5179 | } else { | 8082 | } else { |
5180 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; | 8083 | if (init) |
5181 | } | 8084 | printk(KERN_INFO DRV_NAME |
5182 | 8085 | ": Detected Intel PRO/Wireless 2200BG Network " | |
5183 | if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { | 8086 | "Connection\n"); |
5184 | int start = channel_index; | ||
5185 | for (i = 0; i < MAX_A_CHANNELS; i++) { | ||
5186 | if (band_a_active_channel[i] == 0) | ||
5187 | break; | ||
5188 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5189 | band_a_active_channel[i] == priv->channel) | ||
5190 | continue; | ||
5191 | channel_index++; | ||
5192 | scan.channels_list[channel_index] = | ||
5193 | band_a_active_channel[i]; | ||
5194 | ipw_set_scan_type(&scan, channel_index, scan_type); | ||
5195 | } | ||
5196 | 8087 | ||
5197 | if (start != channel_index) { | 8088 | priv->ieee->abg_true = 0; |
5198 | scan.channels_list[start] = (u8) (IPW_A_MODE << 6) | | 8089 | band = IEEE80211_24GHZ_BAND; |
5199 | (channel_index - start); | 8090 | modulation = IEEE80211_OFDM_MODULATION | |
5200 | channel_index++; | 8091 | IEEE80211_CCK_MODULATION; |
5201 | } | 8092 | priv->adapter = IPW_2200BG; |
8093 | priv->ieee->mode = IEEE_G | IEEE_B; | ||
5202 | } | 8094 | } |
5203 | 8095 | ||
5204 | if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { | 8096 | priv->ieee->freq_band = band; |
5205 | int start = channel_index; | 8097 | priv->ieee->modulation = modulation; |
5206 | for (i = 0; i < MAX_B_CHANNELS; i++) { | ||
5207 | if (band_b_active_channel[i] == 0) | ||
5208 | break; | ||
5209 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5210 | band_b_active_channel[i] == priv->channel) | ||
5211 | continue; | ||
5212 | channel_index++; | ||
5213 | scan.channels_list[channel_index] = | ||
5214 | band_b_active_channel[i]; | ||
5215 | ipw_set_scan_type(&scan, channel_index, scan_type); | ||
5216 | } | ||
5217 | 8098 | ||
5218 | if (start != channel_index) { | 8099 | priv->rates_mask = IEEE80211_DEFAULT_RATES_MASK; |
5219 | scan.channels_list[start] = (u8) (IPW_B_MODE << 6) | | ||
5220 | (channel_index - start); | ||
5221 | } | ||
5222 | } | ||
5223 | 8100 | ||
5224 | err = ipw_send_scan_request_ext(priv, &scan); | 8101 | priv->disassociate_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; |
5225 | if (err) { | 8102 | priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; |
5226 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); | ||
5227 | return -EIO; | ||
5228 | } | ||
5229 | 8103 | ||
5230 | priv->status |= STATUS_SCANNING; | 8104 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; |
5231 | priv->status &= ~STATUS_SCAN_PENDING; | 8105 | priv->short_retry_limit = DEFAULT_SHORT_RETRY_LIMIT; |
8106 | priv->long_retry_limit = DEFAULT_LONG_RETRY_LIMIT; | ||
5232 | 8107 | ||
5233 | return 0; | 8108 | /* If power management is turned on, default to AC mode */ |
8109 | priv->power_mode = IPW_POWER_AC; | ||
8110 | priv->tx_power = IPW_TX_POWER_DEFAULT; | ||
8111 | |||
8112 | return old_mode == priv->ieee->iw_mode; | ||
5234 | } | 8113 | } |
5235 | 8114 | ||
5236 | /* | 8115 | /* |
@@ -5248,12 +8127,16 @@ static int ipw_wx_get_name(struct net_device *dev, | |||
5248 | union iwreq_data *wrqu, char *extra) | 8127 | union iwreq_data *wrqu, char *extra) |
5249 | { | 8128 | { |
5250 | struct ipw_priv *priv = ieee80211_priv(dev); | 8129 | struct ipw_priv *priv = ieee80211_priv(dev); |
5251 | if (!(priv->status & STATUS_ASSOCIATED)) | 8130 | down(&priv->sem); |
8131 | if (priv->status & STATUS_RF_KILL_MASK) | ||
8132 | strcpy(wrqu->name, "radio off"); | ||
8133 | else if (!(priv->status & STATUS_ASSOCIATED)) | ||
5252 | strcpy(wrqu->name, "unassociated"); | 8134 | strcpy(wrqu->name, "unassociated"); |
5253 | else | 8135 | else |
5254 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", | 8136 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", |
5255 | ipw_modes[priv->assoc_request.ieee_mode]); | 8137 | ipw_modes[priv->assoc_request.ieee_mode]); |
5256 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); | 8138 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); |
8139 | up(&priv->sem); | ||
5257 | return 0; | 8140 | return 0; |
5258 | } | 8141 | } |
5259 | 8142 | ||
@@ -5262,13 +8145,9 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) | |||
5262 | if (channel == 0) { | 8145 | if (channel == 0) { |
5263 | IPW_DEBUG_INFO("Setting channel to ANY (0)\n"); | 8146 | IPW_DEBUG_INFO("Setting channel to ANY (0)\n"); |
5264 | priv->config &= ~CFG_STATIC_CHANNEL; | 8147 | priv->config &= ~CFG_STATIC_CHANNEL; |
5265 | if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | | 8148 | IPW_DEBUG_ASSOC("Attempting to associate with new " |
5266 | STATUS_ASSOCIATING))) { | 8149 | "parameters.\n"); |
5267 | IPW_DEBUG_ASSOC("Attempting to associate with new " | 8150 | ipw_associate(priv); |
5268 | "parameters.\n"); | ||
5269 | ipw_associate(priv); | ||
5270 | } | ||
5271 | |||
5272 | return 0; | 8151 | return 0; |
5273 | } | 8152 | } |
5274 | 8153 | ||
@@ -5283,14 +8162,32 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) | |||
5283 | IPW_DEBUG_INFO("Setting channel to %i\n", (int)channel); | 8162 | IPW_DEBUG_INFO("Setting channel to %i\n", (int)channel); |
5284 | priv->channel = channel; | 8163 | priv->channel = channel; |
5285 | 8164 | ||
5286 | /* If we are currently associated, or trying to associate | 8165 | #ifdef CONFIG_IPW2200_MONITOR |
5287 | * then see if this is a new channel (causing us to disassociate) */ | 8166 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { |
5288 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8167 | int i; |
5289 | IPW_DEBUG_ASSOC("Disassociating due to channel change.\n"); | 8168 | if (priv->status & STATUS_SCANNING) { |
5290 | ipw_disassociate(priv); | 8169 | IPW_DEBUG_SCAN("Scan abort triggered due to " |
5291 | } else { | 8170 | "channel change.\n"); |
5292 | ipw_associate(priv); | 8171 | ipw_abort_scan(priv); |
8172 | } | ||
8173 | |||
8174 | for (i = 1000; i && (priv->status & STATUS_SCANNING); i--) | ||
8175 | udelay(10); | ||
8176 | |||
8177 | if (priv->status & STATUS_SCANNING) | ||
8178 | IPW_DEBUG_SCAN("Still scanning...\n"); | ||
8179 | else | ||
8180 | IPW_DEBUG_SCAN("Took %dms to abort current scan\n", | ||
8181 | 1000 - i); | ||
8182 | |||
8183 | return 0; | ||
5293 | } | 8184 | } |
8185 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
8186 | |||
8187 | /* Network configuration changed -- force [re]association */ | ||
8188 | IPW_DEBUG_ASSOC("[re]association triggered due to channel change.\n"); | ||
8189 | if (!ipw_disassociate(priv)) | ||
8190 | ipw_associate(priv); | ||
5294 | 8191 | ||
5295 | return 0; | 8192 | return 0; |
5296 | } | 8193 | } |
@@ -5300,29 +8197,48 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
5300 | union iwreq_data *wrqu, char *extra) | 8197 | union iwreq_data *wrqu, char *extra) |
5301 | { | 8198 | { |
5302 | struct ipw_priv *priv = ieee80211_priv(dev); | 8199 | struct ipw_priv *priv = ieee80211_priv(dev); |
8200 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | ||
5303 | struct iw_freq *fwrq = &wrqu->freq; | 8201 | struct iw_freq *fwrq = &wrqu->freq; |
5304 | 8202 | int ret = 0, i; | |
8203 | u8 channel, flags; | ||
8204 | int band; | ||
8205 | |||
8206 | if (fwrq->m == 0) { | ||
8207 | IPW_DEBUG_WX("SET Freq/Channel -> any\n"); | ||
8208 | down(&priv->sem); | ||
8209 | ret = ipw_set_channel(priv, 0); | ||
8210 | up(&priv->sem); | ||
8211 | return ret; | ||
8212 | } | ||
5305 | /* if setting by freq convert to channel */ | 8213 | /* if setting by freq convert to channel */ |
5306 | if (fwrq->e == 1) { | 8214 | if (fwrq->e == 1) { |
5307 | if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { | 8215 | channel = ipw_freq_to_channel(priv->ieee, fwrq->m); |
5308 | int f = fwrq->m / 100000; | 8216 | if (channel == 0) |
5309 | int c = 0; | 8217 | return -EINVAL; |
8218 | } else | ||
8219 | channel = fwrq->m; | ||
8220 | |||
8221 | if (!(band = ipw_is_valid_channel(priv->ieee, channel))) | ||
8222 | return -EINVAL; | ||
5310 | 8223 | ||
5311 | while ((c < REG_MAX_CHANNEL) && | 8224 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
5312 | (f != ipw_frequencies[c])) | 8225 | i = ipw_channel_to_index(priv->ieee, channel); |
5313 | c++; | 8226 | if (i == -1) |
8227 | return -EINVAL; | ||
5314 | 8228 | ||
5315 | /* hack to fall through */ | 8229 | flags = (band == IEEE80211_24GHZ_BAND) ? |
5316 | fwrq->e = 0; | 8230 | geo->bg[i].flags : geo->a[i].flags; |
5317 | fwrq->m = c + 1; | 8231 | if (flags & IEEE80211_CH_PASSIVE_ONLY) { |
8232 | IPW_DEBUG_WX("Invalid Ad-Hoc channel for 802.11a\n"); | ||
8233 | return -EINVAL; | ||
5318 | } | 8234 | } |
5319 | } | 8235 | } |
5320 | 8236 | ||
5321 | if (fwrq->e > 0 || fwrq->m > 1000) | ||
5322 | return -EOPNOTSUPP; | ||
5323 | |||
5324 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); | 8237 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); |
5325 | return ipw_set_channel(priv, (u8) fwrq->m); | 8238 | down(&priv->sem); |
8239 | ret = ipw_set_channel(priv, channel); | ||
8240 | up(&priv->sem); | ||
8241 | return ret; | ||
5326 | } | 8242 | } |
5327 | 8243 | ||
5328 | static int ipw_wx_get_freq(struct net_device *dev, | 8244 | static int ipw_wx_get_freq(struct net_device *dev, |
@@ -5335,12 +8251,14 @@ static int ipw_wx_get_freq(struct net_device *dev, | |||
5335 | 8251 | ||
5336 | /* If we are associated, trying to associate, or have a statically | 8252 | /* If we are associated, trying to associate, or have a statically |
5337 | * configured CHANNEL then return that; otherwise return ANY */ | 8253 | * configured CHANNEL then return that; otherwise return ANY */ |
8254 | down(&priv->sem); | ||
5338 | if (priv->config & CFG_STATIC_CHANNEL || | 8255 | if (priv->config & CFG_STATIC_CHANNEL || |
5339 | priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) | 8256 | priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) |
5340 | wrqu->freq.m = priv->channel; | 8257 | wrqu->freq.m = priv->channel; |
5341 | else | 8258 | else |
5342 | wrqu->freq.m = 0; | 8259 | wrqu->freq.m = 0; |
5343 | 8260 | ||
8261 | up(&priv->sem); | ||
5344 | IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); | 8262 | IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); |
5345 | return 0; | 8263 | return 0; |
5346 | } | 8264 | } |
@@ -5354,11 +8272,8 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
5354 | 8272 | ||
5355 | IPW_DEBUG_WX("Set MODE: %d\n", wrqu->mode); | 8273 | IPW_DEBUG_WX("Set MODE: %d\n", wrqu->mode); |
5356 | 8274 | ||
5357 | if (wrqu->mode == priv->ieee->iw_mode) | ||
5358 | return 0; | ||
5359 | |||
5360 | switch (wrqu->mode) { | 8275 | switch (wrqu->mode) { |
5361 | #ifdef CONFIG_IPW_PROMISC | 8276 | #ifdef CONFIG_IPW2200_MONITOR |
5362 | case IW_MODE_MONITOR: | 8277 | case IW_MODE_MONITOR: |
5363 | #endif | 8278 | #endif |
5364 | case IW_MODE_ADHOC: | 8279 | case IW_MODE_ADHOC: |
@@ -5370,31 +8285,33 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
5370 | default: | 8285 | default: |
5371 | return -EINVAL; | 8286 | return -EINVAL; |
5372 | } | 8287 | } |
8288 | if (wrqu->mode == priv->ieee->iw_mode) | ||
8289 | return 0; | ||
8290 | |||
8291 | down(&priv->sem); | ||
8292 | |||
8293 | ipw_sw_reset(priv, 0); | ||
5373 | 8294 | ||
5374 | #ifdef CONFIG_IPW_PROMISC | 8295 | #ifdef CONFIG_IPW2200_MONITOR |
5375 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) | 8296 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) |
5376 | priv->net_dev->type = ARPHRD_ETHER; | 8297 | priv->net_dev->type = ARPHRD_ETHER; |
5377 | 8298 | ||
5378 | if (wrqu->mode == IW_MODE_MONITOR) | 8299 | if (wrqu->mode == IW_MODE_MONITOR) |
8300 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
8301 | priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
8302 | #else | ||
5379 | priv->net_dev->type = ARPHRD_IEEE80211; | 8303 | priv->net_dev->type = ARPHRD_IEEE80211; |
5380 | #endif /* CONFIG_IPW_PROMISC */ | 8304 | #endif |
8305 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
5381 | 8306 | ||
5382 | #ifdef CONFIG_PM | ||
5383 | /* Free the existing firmware and reset the fw_loaded | 8307 | /* Free the existing firmware and reset the fw_loaded |
5384 | * flag so ipw_load() will bring in the new firmawre */ | 8308 | * flag so ipw_load() will bring in the new firmawre */ |
5385 | if (fw_loaded) { | 8309 | free_firmware(); |
5386 | fw_loaded = 0; | ||
5387 | } | ||
5388 | |||
5389 | release_firmware(bootfw); | ||
5390 | release_firmware(ucode); | ||
5391 | release_firmware(firmware); | ||
5392 | bootfw = ucode = firmware = NULL; | ||
5393 | #endif | ||
5394 | 8310 | ||
5395 | priv->ieee->iw_mode = wrqu->mode; | 8311 | priv->ieee->iw_mode = wrqu->mode; |
5396 | ipw_adapter_restart(priv); | ||
5397 | 8312 | ||
8313 | queue_work(priv->workqueue, &priv->adapter_restart); | ||
8314 | up(&priv->sem); | ||
5398 | return err; | 8315 | return err; |
5399 | } | 8316 | } |
5400 | 8317 | ||
@@ -5403,20 +8320,13 @@ static int ipw_wx_get_mode(struct net_device *dev, | |||
5403 | union iwreq_data *wrqu, char *extra) | 8320 | union iwreq_data *wrqu, char *extra) |
5404 | { | 8321 | { |
5405 | struct ipw_priv *priv = ieee80211_priv(dev); | 8322 | struct ipw_priv *priv = ieee80211_priv(dev); |
5406 | 8323 | down(&priv->sem); | |
5407 | wrqu->mode = priv->ieee->iw_mode; | 8324 | wrqu->mode = priv->ieee->iw_mode; |
5408 | IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); | 8325 | IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); |
5409 | 8326 | up(&priv->sem); | |
5410 | return 0; | 8327 | return 0; |
5411 | } | 8328 | } |
5412 | 8329 | ||
5413 | #define DEFAULT_RTS_THRESHOLD 2304U | ||
5414 | #define MIN_RTS_THRESHOLD 1U | ||
5415 | #define MAX_RTS_THRESHOLD 2304U | ||
5416 | #define DEFAULT_BEACON_INTERVAL 100U | ||
5417 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | ||
5418 | #define DEFAULT_LONG_RETRY_LIMIT 4U | ||
5419 | |||
5420 | /* Values are in microsecond */ | 8330 | /* Values are in microsecond */ |
5421 | static const s32 timeout_duration[] = { | 8331 | static const s32 timeout_duration[] = { |
5422 | 350000, | 8332 | 350000, |
@@ -5440,8 +8350,8 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5440 | { | 8350 | { |
5441 | struct ipw_priv *priv = ieee80211_priv(dev); | 8351 | struct ipw_priv *priv = ieee80211_priv(dev); |
5442 | struct iw_range *range = (struct iw_range *)extra; | 8352 | struct iw_range *range = (struct iw_range *)extra; |
5443 | u16 val; | 8353 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); |
5444 | int i; | 8354 | int i = 0, j; |
5445 | 8355 | ||
5446 | wrqu->data.length = sizeof(*range); | 8356 | wrqu->data.length = sizeof(*range); |
5447 | memset(range, 0, sizeof(*range)); | 8357 | memset(range, 0, sizeof(*range)); |
@@ -5452,7 +8362,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5452 | range->max_qual.qual = 100; | 8362 | range->max_qual.qual = 100; |
5453 | /* TODO: Find real max RSSI and stick here */ | 8363 | /* TODO: Find real max RSSI and stick here */ |
5454 | range->max_qual.level = 0; | 8364 | range->max_qual.level = 0; |
5455 | range->max_qual.noise = 0; | 8365 | range->max_qual.noise = priv->ieee->worst_rssi + 0x100; |
5456 | range->max_qual.updated = 7; /* Updated all three */ | 8366 | range->max_qual.updated = 7; /* Updated all three */ |
5457 | 8367 | ||
5458 | range->avg_qual.qual = 70; | 8368 | range->avg_qual.qual = 70; |
@@ -5460,7 +8370,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5460 | range->avg_qual.level = 0; /* FIXME to real average level */ | 8370 | range->avg_qual.level = 0; /* FIXME to real average level */ |
5461 | range->avg_qual.noise = 0; | 8371 | range->avg_qual.noise = 0; |
5462 | range->avg_qual.updated = 7; /* Updated all three */ | 8372 | range->avg_qual.updated = 7; /* Updated all three */ |
5463 | 8373 | down(&priv->sem); | |
5464 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); | 8374 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); |
5465 | 8375 | ||
5466 | for (i = 0; i < range->num_bitrates; i++) | 8376 | for (i = 0; i < range->num_bitrates; i++) |
@@ -5480,19 +8390,35 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5480 | range->we_version_compiled = WIRELESS_EXT; | 8390 | range->we_version_compiled = WIRELESS_EXT; |
5481 | range->we_version_source = 16; | 8391 | range->we_version_source = 16; |
5482 | 8392 | ||
5483 | range->num_channels = FREQ_COUNT; | 8393 | i = 0; |
5484 | 8394 | if (priv->ieee->mode & (IEEE_B | IEEE_G)) { | |
5485 | val = 0; | 8395 | for (j = 0; j < geo->bg_channels && i < IW_MAX_FREQUENCIES; |
5486 | for (i = 0; i < FREQ_COUNT; i++) { | 8396 | i++, j++) { |
5487 | range->freq[val].i = i + 1; | 8397 | range->freq[i].i = geo->bg[j].channel; |
5488 | range->freq[val].m = ipw_frequencies[i] * 100000; | 8398 | range->freq[i].m = geo->bg[j].freq * 100000; |
5489 | range->freq[val].e = 1; | 8399 | range->freq[i].e = 1; |
5490 | val++; | 8400 | } |
8401 | } | ||
5491 | 8402 | ||
5492 | if (val == IW_MAX_FREQUENCIES) | 8403 | if (priv->ieee->mode & IEEE_A) { |
5493 | break; | 8404 | for (j = 0; j < geo->a_channels && i < IW_MAX_FREQUENCIES; |
8405 | i++, j++) { | ||
8406 | range->freq[i].i = geo->a[j].channel; | ||
8407 | range->freq[i].m = geo->a[j].freq * 100000; | ||
8408 | range->freq[i].e = 1; | ||
8409 | } | ||
5494 | } | 8410 | } |
5495 | range->num_frequency = val; | 8411 | |
8412 | range->num_channels = i; | ||
8413 | range->num_frequency = i; | ||
8414 | |||
8415 | up(&priv->sem); | ||
8416 | |||
8417 | /* Event capability (kernel + driver) */ | ||
8418 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | | ||
8419 | IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | | ||
8420 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | ||
8421 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | ||
5496 | 8422 | ||
5497 | IPW_DEBUG_WX("GET Range\n"); | 8423 | IPW_DEBUG_WX("GET Range\n"); |
5498 | return 0; | 8424 | return 0; |
@@ -5513,25 +8439,23 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
5513 | 8439 | ||
5514 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) | 8440 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) |
5515 | return -EINVAL; | 8441 | return -EINVAL; |
5516 | 8442 | down(&priv->sem); | |
5517 | if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || | 8443 | if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || |
5518 | !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { | 8444 | !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { |
5519 | /* we disable mandatory BSSID association */ | 8445 | /* we disable mandatory BSSID association */ |
5520 | IPW_DEBUG_WX("Setting AP BSSID to ANY\n"); | 8446 | IPW_DEBUG_WX("Setting AP BSSID to ANY\n"); |
5521 | priv->config &= ~CFG_STATIC_BSSID; | 8447 | priv->config &= ~CFG_STATIC_BSSID; |
5522 | if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | | 8448 | IPW_DEBUG_ASSOC("Attempting to associate with new " |
5523 | STATUS_ASSOCIATING))) { | 8449 | "parameters.\n"); |
5524 | IPW_DEBUG_ASSOC("Attempting to associate with new " | 8450 | ipw_associate(priv); |
5525 | "parameters.\n"); | 8451 | up(&priv->sem); |
5526 | ipw_associate(priv); | ||
5527 | } | ||
5528 | |||
5529 | return 0; | 8452 | return 0; |
5530 | } | 8453 | } |
5531 | 8454 | ||
5532 | priv->config |= CFG_STATIC_BSSID; | 8455 | priv->config |= CFG_STATIC_BSSID; |
5533 | if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { | 8456 | if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { |
5534 | IPW_DEBUG_WX("BSSID set to current BSSID.\n"); | 8457 | IPW_DEBUG_WX("BSSID set to current BSSID.\n"); |
8458 | up(&priv->sem); | ||
5535 | return 0; | 8459 | return 0; |
5536 | } | 8460 | } |
5537 | 8461 | ||
@@ -5540,15 +8464,12 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
5540 | 8464 | ||
5541 | memcpy(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN); | 8465 | memcpy(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN); |
5542 | 8466 | ||
5543 | /* If we are currently associated, or trying to associate | 8467 | /* Network configuration changed -- force [re]association */ |
5544 | * then see if this is a new BSSID (causing us to disassociate) */ | 8468 | IPW_DEBUG_ASSOC("[re]association triggered due to BSSID change.\n"); |
5545 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8469 | if (!ipw_disassociate(priv)) |
5546 | IPW_DEBUG_ASSOC("Disassociating due to BSSID change.\n"); | ||
5547 | ipw_disassociate(priv); | ||
5548 | } else { | ||
5549 | ipw_associate(priv); | 8470 | ipw_associate(priv); |
5550 | } | ||
5551 | 8471 | ||
8472 | up(&priv->sem); | ||
5552 | return 0; | 8473 | return 0; |
5553 | } | 8474 | } |
5554 | 8475 | ||
@@ -5559,15 +8480,17 @@ static int ipw_wx_get_wap(struct net_device *dev, | |||
5559 | struct ipw_priv *priv = ieee80211_priv(dev); | 8480 | struct ipw_priv *priv = ieee80211_priv(dev); |
5560 | /* If we are associated, trying to associate, or have a statically | 8481 | /* If we are associated, trying to associate, or have a statically |
5561 | * configured BSSID then return that; otherwise return ANY */ | 8482 | * configured BSSID then return that; otherwise return ANY */ |
8483 | down(&priv->sem); | ||
5562 | if (priv->config & CFG_STATIC_BSSID || | 8484 | if (priv->config & CFG_STATIC_BSSID || |
5563 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8485 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
5564 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; | 8486 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; |
5565 | memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); | 8487 | memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); |
5566 | } else | 8488 | } else |
5567 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); | 8489 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); |
5568 | 8490 | ||
5569 | IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", | 8491 | IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", |
5570 | MAC_ARG(wrqu->ap_addr.sa_data)); | 8492 | MAC_ARG(wrqu->ap_addr.sa_data)); |
8493 | up(&priv->sem); | ||
5571 | return 0; | 8494 | return 0; |
5572 | } | 8495 | } |
5573 | 8496 | ||
@@ -5578,21 +8501,22 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
5578 | struct ipw_priv *priv = ieee80211_priv(dev); | 8501 | struct ipw_priv *priv = ieee80211_priv(dev); |
5579 | char *essid = ""; /* ANY */ | 8502 | char *essid = ""; /* ANY */ |
5580 | int length = 0; | 8503 | int length = 0; |
5581 | 8504 | down(&priv->sem); | |
5582 | if (wrqu->essid.flags && wrqu->essid.length) { | 8505 | if (wrqu->essid.flags && wrqu->essid.length) { |
5583 | length = wrqu->essid.length - 1; | 8506 | length = wrqu->essid.length - 1; |
5584 | essid = extra; | 8507 | essid = extra; |
5585 | } | 8508 | } |
5586 | if (length == 0) { | 8509 | if (length == 0) { |
5587 | IPW_DEBUG_WX("Setting ESSID to ANY\n"); | 8510 | IPW_DEBUG_WX("Setting ESSID to ANY\n"); |
5588 | priv->config &= ~CFG_STATIC_ESSID; | 8511 | if ((priv->config & CFG_STATIC_ESSID) && |
5589 | if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | | 8512 | !(priv->status & (STATUS_ASSOCIATED | |
5590 | STATUS_ASSOCIATING))) { | 8513 | STATUS_ASSOCIATING))) { |
5591 | IPW_DEBUG_ASSOC("Attempting to associate with new " | 8514 | IPW_DEBUG_ASSOC("Attempting to associate with new " |
5592 | "parameters.\n"); | 8515 | "parameters.\n"); |
8516 | priv->config &= ~CFG_STATIC_ESSID; | ||
5593 | ipw_associate(priv); | 8517 | ipw_associate(priv); |
5594 | } | 8518 | } |
5595 | 8519 | up(&priv->sem); | |
5596 | return 0; | 8520 | return 0; |
5597 | } | 8521 | } |
5598 | 8522 | ||
@@ -5602,6 +8526,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
5602 | 8526 | ||
5603 | if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { | 8527 | if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { |
5604 | IPW_DEBUG_WX("ESSID set to current ESSID.\n"); | 8528 | IPW_DEBUG_WX("ESSID set to current ESSID.\n"); |
8529 | up(&priv->sem); | ||
5605 | return 0; | 8530 | return 0; |
5606 | } | 8531 | } |
5607 | 8532 | ||
@@ -5611,15 +8536,12 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
5611 | priv->essid_len = length; | 8536 | priv->essid_len = length; |
5612 | memcpy(priv->essid, essid, priv->essid_len); | 8537 | memcpy(priv->essid, essid, priv->essid_len); |
5613 | 8538 | ||
5614 | /* If we are currently associated, or trying to associate | 8539 | /* Network configuration changed -- force [re]association */ |
5615 | * then see if this is a new ESSID (causing us to disassociate) */ | 8540 | IPW_DEBUG_ASSOC("[re]association triggered due to ESSID change.\n"); |
5616 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8541 | if (!ipw_disassociate(priv)) |
5617 | IPW_DEBUG_ASSOC("Disassociating due to ESSID change.\n"); | ||
5618 | ipw_disassociate(priv); | ||
5619 | } else { | ||
5620 | ipw_associate(priv); | 8542 | ipw_associate(priv); |
5621 | } | ||
5622 | 8543 | ||
8544 | up(&priv->sem); | ||
5623 | return 0; | 8545 | return 0; |
5624 | } | 8546 | } |
5625 | 8547 | ||
@@ -5631,6 +8553,7 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
5631 | 8553 | ||
5632 | /* If we are associated, trying to associate, or have a statically | 8554 | /* If we are associated, trying to associate, or have a statically |
5633 | * configured ESSID then return that; otherwise return ANY */ | 8555 | * configured ESSID then return that; otherwise return ANY */ |
8556 | down(&priv->sem); | ||
5634 | if (priv->config & CFG_STATIC_ESSID || | 8557 | if (priv->config & CFG_STATIC_ESSID || |
5635 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8558 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
5636 | IPW_DEBUG_WX("Getting essid: '%s'\n", | 8559 | IPW_DEBUG_WX("Getting essid: '%s'\n", |
@@ -5643,7 +8566,7 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
5643 | wrqu->essid.length = 0; | 8566 | wrqu->essid.length = 0; |
5644 | wrqu->essid.flags = 0; /* active */ | 8567 | wrqu->essid.flags = 0; /* active */ |
5645 | } | 8568 | } |
5646 | 8569 | up(&priv->sem); | |
5647 | return 0; | 8570 | return 0; |
5648 | } | 8571 | } |
5649 | 8572 | ||
@@ -5656,11 +8579,12 @@ static int ipw_wx_set_nick(struct net_device *dev, | |||
5656 | IPW_DEBUG_WX("Setting nick to '%s'\n", extra); | 8579 | IPW_DEBUG_WX("Setting nick to '%s'\n", extra); |
5657 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) | 8580 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) |
5658 | return -E2BIG; | 8581 | return -E2BIG; |
5659 | 8582 | down(&priv->sem); | |
5660 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); | 8583 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); |
5661 | memset(priv->nick, 0, sizeof(priv->nick)); | 8584 | memset(priv->nick, 0, sizeof(priv->nick)); |
5662 | memcpy(priv->nick, extra, wrqu->data.length); | 8585 | memcpy(priv->nick, extra, wrqu->data.length); |
5663 | IPW_DEBUG_TRACE("<<\n"); | 8586 | IPW_DEBUG_TRACE("<<\n"); |
8587 | up(&priv->sem); | ||
5664 | return 0; | 8588 | return 0; |
5665 | 8589 | ||
5666 | } | 8590 | } |
@@ -5671,9 +8595,11 @@ static int ipw_wx_get_nick(struct net_device *dev, | |||
5671 | { | 8595 | { |
5672 | struct ipw_priv *priv = ieee80211_priv(dev); | 8596 | struct ipw_priv *priv = ieee80211_priv(dev); |
5673 | IPW_DEBUG_WX("Getting nick\n"); | 8597 | IPW_DEBUG_WX("Getting nick\n"); |
8598 | down(&priv->sem); | ||
5674 | wrqu->data.length = strlen(priv->nick) + 1; | 8599 | wrqu->data.length = strlen(priv->nick) + 1; |
5675 | memcpy(extra, priv->nick, wrqu->data.length); | 8600 | memcpy(extra, priv->nick, wrqu->data.length); |
5676 | wrqu->data.flags = 1; /* active */ | 8601 | wrqu->data.flags = 1; /* active */ |
8602 | up(&priv->sem); | ||
5677 | return 0; | 8603 | return 0; |
5678 | } | 8604 | } |
5679 | 8605 | ||
@@ -5681,8 +8607,113 @@ static int ipw_wx_set_rate(struct net_device *dev, | |||
5681 | struct iw_request_info *info, | 8607 | struct iw_request_info *info, |
5682 | union iwreq_data *wrqu, char *extra) | 8608 | union iwreq_data *wrqu, char *extra) |
5683 | { | 8609 | { |
5684 | IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); | 8610 | /* TODO: We should use semaphores or locks for access to priv */ |
5685 | return -EOPNOTSUPP; | 8611 | struct ipw_priv *priv = ieee80211_priv(dev); |
8612 | u32 target_rate = wrqu->bitrate.value; | ||
8613 | u32 fixed, mask; | ||
8614 | |||
8615 | /* value = -1, fixed = 0 means auto only, so we should use all rates offered by AP */ | ||
8616 | /* value = X, fixed = 1 means only rate X */ | ||
8617 | /* value = X, fixed = 0 means all rates lower equal X */ | ||
8618 | |||
8619 | if (target_rate == -1) { | ||
8620 | fixed = 0; | ||
8621 | mask = IEEE80211_DEFAULT_RATES_MASK; | ||
8622 | /* Now we should reassociate */ | ||
8623 | goto apply; | ||
8624 | } | ||
8625 | |||
8626 | mask = 0; | ||
8627 | fixed = wrqu->bitrate.fixed; | ||
8628 | |||
8629 | if (target_rate == 1000000 || !fixed) | ||
8630 | mask |= IEEE80211_CCK_RATE_1MB_MASK; | ||
8631 | if (target_rate == 1000000) | ||
8632 | goto apply; | ||
8633 | |||
8634 | if (target_rate == 2000000 || !fixed) | ||
8635 | mask |= IEEE80211_CCK_RATE_2MB_MASK; | ||
8636 | if (target_rate == 2000000) | ||
8637 | goto apply; | ||
8638 | |||
8639 | if (target_rate == 5500000 || !fixed) | ||
8640 | mask |= IEEE80211_CCK_RATE_5MB_MASK; | ||
8641 | if (target_rate == 5500000) | ||
8642 | goto apply; | ||
8643 | |||
8644 | if (target_rate == 6000000 || !fixed) | ||
8645 | mask |= IEEE80211_OFDM_RATE_6MB_MASK; | ||
8646 | if (target_rate == 6000000) | ||
8647 | goto apply; | ||
8648 | |||
8649 | if (target_rate == 9000000 || !fixed) | ||
8650 | mask |= IEEE80211_OFDM_RATE_9MB_MASK; | ||
8651 | if (target_rate == 9000000) | ||
8652 | goto apply; | ||
8653 | |||
8654 | if (target_rate == 11000000 || !fixed) | ||
8655 | mask |= IEEE80211_CCK_RATE_11MB_MASK; | ||
8656 | if (target_rate == 11000000) | ||
8657 | goto apply; | ||
8658 | |||
8659 | if (target_rate == 12000000 || !fixed) | ||
8660 | mask |= IEEE80211_OFDM_RATE_12MB_MASK; | ||
8661 | if (target_rate == 12000000) | ||
8662 | goto apply; | ||
8663 | |||
8664 | if (target_rate == 18000000 || !fixed) | ||
8665 | mask |= IEEE80211_OFDM_RATE_18MB_MASK; | ||
8666 | if (target_rate == 18000000) | ||
8667 | goto apply; | ||
8668 | |||
8669 | if (target_rate == 24000000 || !fixed) | ||
8670 | mask |= IEEE80211_OFDM_RATE_24MB_MASK; | ||
8671 | if (target_rate == 24000000) | ||
8672 | goto apply; | ||
8673 | |||
8674 | if (target_rate == 36000000 || !fixed) | ||
8675 | mask |= IEEE80211_OFDM_RATE_36MB_MASK; | ||
8676 | if (target_rate == 36000000) | ||
8677 | goto apply; | ||
8678 | |||
8679 | if (target_rate == 48000000 || !fixed) | ||
8680 | mask |= IEEE80211_OFDM_RATE_48MB_MASK; | ||
8681 | if (target_rate == 48000000) | ||
8682 | goto apply; | ||
8683 | |||
8684 | if (target_rate == 54000000 || !fixed) | ||
8685 | mask |= IEEE80211_OFDM_RATE_54MB_MASK; | ||
8686 | if (target_rate == 54000000) | ||
8687 | goto apply; | ||
8688 | |||
8689 | IPW_DEBUG_WX("invalid rate specified, returning error\n"); | ||
8690 | return -EINVAL; | ||
8691 | |||
8692 | apply: | ||
8693 | IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", | ||
8694 | mask, fixed ? "fixed" : "sub-rates"); | ||
8695 | down(&priv->sem); | ||
8696 | if (mask == IEEE80211_DEFAULT_RATES_MASK) { | ||
8697 | priv->config &= ~CFG_FIXED_RATE; | ||
8698 | ipw_set_fixed_rate(priv, priv->ieee->mode); | ||
8699 | } else | ||
8700 | priv->config |= CFG_FIXED_RATE; | ||
8701 | |||
8702 | if (priv->rates_mask == mask) { | ||
8703 | IPW_DEBUG_WX("Mask set to current mask.\n"); | ||
8704 | up(&priv->sem); | ||
8705 | return 0; | ||
8706 | } | ||
8707 | |||
8708 | priv->rates_mask = mask; | ||
8709 | |||
8710 | /* Network configuration changed -- force [re]association */ | ||
8711 | IPW_DEBUG_ASSOC("[re]association triggered due to rates change.\n"); | ||
8712 | if (!ipw_disassociate(priv)) | ||
8713 | ipw_associate(priv); | ||
8714 | |||
8715 | up(&priv->sem); | ||
8716 | return 0; | ||
5686 | } | 8717 | } |
5687 | 8718 | ||
5688 | static int ipw_wx_get_rate(struct net_device *dev, | 8719 | static int ipw_wx_get_rate(struct net_device *dev, |
@@ -5690,8 +8721,9 @@ static int ipw_wx_get_rate(struct net_device *dev, | |||
5690 | union iwreq_data *wrqu, char *extra) | 8721 | union iwreq_data *wrqu, char *extra) |
5691 | { | 8722 | { |
5692 | struct ipw_priv *priv = ieee80211_priv(dev); | 8723 | struct ipw_priv *priv = ieee80211_priv(dev); |
8724 | down(&priv->sem); | ||
5693 | wrqu->bitrate.value = priv->last_rate; | 8725 | wrqu->bitrate.value = priv->last_rate; |
5694 | 8726 | up(&priv->sem); | |
5695 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); | 8727 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); |
5696 | return 0; | 8728 | return 0; |
5697 | } | 8729 | } |
@@ -5701,18 +8733,20 @@ static int ipw_wx_set_rts(struct net_device *dev, | |||
5701 | union iwreq_data *wrqu, char *extra) | 8733 | union iwreq_data *wrqu, char *extra) |
5702 | { | 8734 | { |
5703 | struct ipw_priv *priv = ieee80211_priv(dev); | 8735 | struct ipw_priv *priv = ieee80211_priv(dev); |
5704 | 8736 | down(&priv->sem); | |
5705 | if (wrqu->rts.disabled) | 8737 | if (wrqu->rts.disabled) |
5706 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; | 8738 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; |
5707 | else { | 8739 | else { |
5708 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || | 8740 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || |
5709 | wrqu->rts.value > MAX_RTS_THRESHOLD) | 8741 | wrqu->rts.value > MAX_RTS_THRESHOLD) { |
8742 | up(&priv->sem); | ||
5710 | return -EINVAL; | 8743 | return -EINVAL; |
5711 | 8744 | } | |
5712 | priv->rts_threshold = wrqu->rts.value; | 8745 | priv->rts_threshold = wrqu->rts.value; |
5713 | } | 8746 | } |
5714 | 8747 | ||
5715 | ipw_send_rts_threshold(priv, priv->rts_threshold); | 8748 | ipw_send_rts_threshold(priv, priv->rts_threshold); |
8749 | up(&priv->sem); | ||
5716 | IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); | 8750 | IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); |
5717 | return 0; | 8751 | return 0; |
5718 | } | 8752 | } |
@@ -5722,10 +8756,11 @@ static int ipw_wx_get_rts(struct net_device *dev, | |||
5722 | union iwreq_data *wrqu, char *extra) | 8756 | union iwreq_data *wrqu, char *extra) |
5723 | { | 8757 | { |
5724 | struct ipw_priv *priv = ieee80211_priv(dev); | 8758 | struct ipw_priv *priv = ieee80211_priv(dev); |
8759 | down(&priv->sem); | ||
5725 | wrqu->rts.value = priv->rts_threshold; | 8760 | wrqu->rts.value = priv->rts_threshold; |
5726 | wrqu->rts.fixed = 0; /* no auto select */ | 8761 | wrqu->rts.fixed = 0; /* no auto select */ |
5727 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); | 8762 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); |
5728 | 8763 | up(&priv->sem); | |
5729 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); | 8764 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); |
5730 | return 0; | 8765 | return 0; |
5731 | } | 8766 | } |
@@ -5735,41 +8770,33 @@ static int ipw_wx_set_txpow(struct net_device *dev, | |||
5735 | union iwreq_data *wrqu, char *extra) | 8770 | union iwreq_data *wrqu, char *extra) |
5736 | { | 8771 | { |
5737 | struct ipw_priv *priv = ieee80211_priv(dev); | 8772 | struct ipw_priv *priv = ieee80211_priv(dev); |
5738 | struct ipw_tx_power tx_power; | 8773 | int err = 0; |
5739 | int i; | ||
5740 | |||
5741 | if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) | ||
5742 | return -EINPROGRESS; | ||
5743 | |||
5744 | if (wrqu->power.flags != IW_TXPOW_DBM) | ||
5745 | return -EINVAL; | ||
5746 | 8774 | ||
5747 | if ((wrqu->power.value > 20) || (wrqu->power.value < -12)) | 8775 | down(&priv->sem); |
5748 | return -EINVAL; | 8776 | if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { |
8777 | err = -EINPROGRESS; | ||
8778 | goto out; | ||
8779 | } | ||
5749 | 8780 | ||
5750 | priv->tx_power = wrqu->power.value; | 8781 | if (!wrqu->power.fixed) |
8782 | wrqu->power.value = IPW_TX_POWER_DEFAULT; | ||
5751 | 8783 | ||
5752 | memset(&tx_power, 0, sizeof(tx_power)); | 8784 | if (wrqu->power.flags != IW_TXPOW_DBM) { |
5753 | 8785 | err = -EINVAL; | |
5754 | /* configure device for 'G' band */ | 8786 | goto out; |
5755 | tx_power.ieee_mode = IPW_G_MODE; | ||
5756 | tx_power.num_channels = 11; | ||
5757 | for (i = 0; i < 11; i++) { | ||
5758 | tx_power.channels_tx_power[i].channel_number = i + 1; | ||
5759 | tx_power.channels_tx_power[i].tx_power = priv->tx_power; | ||
5760 | } | 8787 | } |
5761 | if (ipw_send_tx_power(priv, &tx_power)) | ||
5762 | goto error; | ||
5763 | 8788 | ||
5764 | /* configure device to also handle 'B' band */ | 8789 | if ((wrqu->power.value > IPW_TX_POWER_MAX) || |
5765 | tx_power.ieee_mode = IPW_B_MODE; | 8790 | (wrqu->power.value < IPW_TX_POWER_MIN)) { |
5766 | if (ipw_send_tx_power(priv, &tx_power)) | 8791 | err = -EINVAL; |
5767 | goto error; | 8792 | goto out; |
5768 | 8793 | } | |
5769 | return 0; | ||
5770 | 8794 | ||
5771 | error: | 8795 | priv->tx_power = wrqu->power.value; |
5772 | return -EIO; | 8796 | err = ipw_set_tx_power(priv); |
8797 | out: | ||
8798 | up(&priv->sem); | ||
8799 | return err; | ||
5773 | } | 8800 | } |
5774 | 8801 | ||
5775 | static int ipw_wx_get_txpow(struct net_device *dev, | 8802 | static int ipw_wx_get_txpow(struct net_device *dev, |
@@ -5777,14 +8804,15 @@ static int ipw_wx_get_txpow(struct net_device *dev, | |||
5777 | union iwreq_data *wrqu, char *extra) | 8804 | union iwreq_data *wrqu, char *extra) |
5778 | { | 8805 | { |
5779 | struct ipw_priv *priv = ieee80211_priv(dev); | 8806 | struct ipw_priv *priv = ieee80211_priv(dev); |
5780 | 8807 | down(&priv->sem); | |
5781 | wrqu->power.value = priv->tx_power; | 8808 | wrqu->power.value = priv->tx_power; |
5782 | wrqu->power.fixed = 1; | 8809 | wrqu->power.fixed = 1; |
5783 | wrqu->power.flags = IW_TXPOW_DBM; | 8810 | wrqu->power.flags = IW_TXPOW_DBM; |
5784 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; | 8811 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; |
8812 | up(&priv->sem); | ||
5785 | 8813 | ||
5786 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", | 8814 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", |
5787 | wrqu->power.disabled ? "ON" : "OFF", wrqu->power.value); | 8815 | wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); |
5788 | 8816 | ||
5789 | return 0; | 8817 | return 0; |
5790 | } | 8818 | } |
@@ -5794,18 +8822,21 @@ static int ipw_wx_set_frag(struct net_device *dev, | |||
5794 | union iwreq_data *wrqu, char *extra) | 8822 | union iwreq_data *wrqu, char *extra) |
5795 | { | 8823 | { |
5796 | struct ipw_priv *priv = ieee80211_priv(dev); | 8824 | struct ipw_priv *priv = ieee80211_priv(dev); |
5797 | 8825 | down(&priv->sem); | |
5798 | if (wrqu->frag.disabled) | 8826 | if (wrqu->frag.disabled) |
5799 | priv->ieee->fts = DEFAULT_FTS; | 8827 | priv->ieee->fts = DEFAULT_FTS; |
5800 | else { | 8828 | else { |
5801 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || | 8829 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || |
5802 | wrqu->frag.value > MAX_FRAG_THRESHOLD) | 8830 | wrqu->frag.value > MAX_FRAG_THRESHOLD) { |
8831 | up(&priv->sem); | ||
5803 | return -EINVAL; | 8832 | return -EINVAL; |
8833 | } | ||
5804 | 8834 | ||
5805 | priv->ieee->fts = wrqu->frag.value & ~0x1; | 8835 | priv->ieee->fts = wrqu->frag.value & ~0x1; |
5806 | } | 8836 | } |
5807 | 8837 | ||
5808 | ipw_send_frag_threshold(priv, wrqu->frag.value); | 8838 | ipw_send_frag_threshold(priv, wrqu->frag.value); |
8839 | up(&priv->sem); | ||
5809 | IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); | 8840 | IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); |
5810 | return 0; | 8841 | return 0; |
5811 | } | 8842 | } |
@@ -5815,10 +8846,11 @@ static int ipw_wx_get_frag(struct net_device *dev, | |||
5815 | union iwreq_data *wrqu, char *extra) | 8846 | union iwreq_data *wrqu, char *extra) |
5816 | { | 8847 | { |
5817 | struct ipw_priv *priv = ieee80211_priv(dev); | 8848 | struct ipw_priv *priv = ieee80211_priv(dev); |
8849 | down(&priv->sem); | ||
5818 | wrqu->frag.value = priv->ieee->fts; | 8850 | wrqu->frag.value = priv->ieee->fts; |
5819 | wrqu->frag.fixed = 0; /* no auto select */ | 8851 | wrqu->frag.fixed = 0; /* no auto select */ |
5820 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); | 8852 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); |
5821 | 8853 | up(&priv->sem); | |
5822 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); | 8854 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); |
5823 | 8855 | ||
5824 | return 0; | 8856 | return 0; |
@@ -5828,16 +8860,128 @@ static int ipw_wx_set_retry(struct net_device *dev, | |||
5828 | struct iw_request_info *info, | 8860 | struct iw_request_info *info, |
5829 | union iwreq_data *wrqu, char *extra) | 8861 | union iwreq_data *wrqu, char *extra) |
5830 | { | 8862 | { |
5831 | IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); | 8863 | struct ipw_priv *priv = ieee80211_priv(dev); |
5832 | return -EOPNOTSUPP; | 8864 | |
8865 | if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) | ||
8866 | return -EINVAL; | ||
8867 | |||
8868 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) | ||
8869 | return 0; | ||
8870 | |||
8871 | if (wrqu->retry.value < 0 || wrqu->retry.value > 255) | ||
8872 | return -EINVAL; | ||
8873 | |||
8874 | down(&priv->sem); | ||
8875 | if (wrqu->retry.flags & IW_RETRY_MIN) | ||
8876 | priv->short_retry_limit = (u8) wrqu->retry.value; | ||
8877 | else if (wrqu->retry.flags & IW_RETRY_MAX) | ||
8878 | priv->long_retry_limit = (u8) wrqu->retry.value; | ||
8879 | else { | ||
8880 | priv->short_retry_limit = (u8) wrqu->retry.value; | ||
8881 | priv->long_retry_limit = (u8) wrqu->retry.value; | ||
8882 | } | ||
8883 | |||
8884 | ipw_send_retry_limit(priv, priv->short_retry_limit, | ||
8885 | priv->long_retry_limit); | ||
8886 | up(&priv->sem); | ||
8887 | IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", | ||
8888 | priv->short_retry_limit, priv->long_retry_limit); | ||
8889 | return 0; | ||
5833 | } | 8890 | } |
5834 | 8891 | ||
5835 | static int ipw_wx_get_retry(struct net_device *dev, | 8892 | static int ipw_wx_get_retry(struct net_device *dev, |
5836 | struct iw_request_info *info, | 8893 | struct iw_request_info *info, |
5837 | union iwreq_data *wrqu, char *extra) | 8894 | union iwreq_data *wrqu, char *extra) |
5838 | { | 8895 | { |
5839 | IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); | 8896 | struct ipw_priv *priv = ieee80211_priv(dev); |
5840 | return -EOPNOTSUPP; | 8897 | |
8898 | down(&priv->sem); | ||
8899 | wrqu->retry.disabled = 0; | ||
8900 | |||
8901 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | ||
8902 | up(&priv->sem); | ||
8903 | return -EINVAL; | ||
8904 | } | ||
8905 | |||
8906 | if (wrqu->retry.flags & IW_RETRY_MAX) { | ||
8907 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; | ||
8908 | wrqu->retry.value = priv->long_retry_limit; | ||
8909 | } else if (wrqu->retry.flags & IW_RETRY_MIN) { | ||
8910 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; | ||
8911 | wrqu->retry.value = priv->short_retry_limit; | ||
8912 | } else { | ||
8913 | wrqu->retry.flags = IW_RETRY_LIMIT; | ||
8914 | wrqu->retry.value = priv->short_retry_limit; | ||
8915 | } | ||
8916 | up(&priv->sem); | ||
8917 | |||
8918 | IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value); | ||
8919 | |||
8920 | return 0; | ||
8921 | } | ||
8922 | |||
8923 | static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | ||
8924 | int essid_len) | ||
8925 | { | ||
8926 | struct ipw_scan_request_ext scan; | ||
8927 | int err = 0, scan_type; | ||
8928 | |||
8929 | down(&priv->sem); | ||
8930 | |||
8931 | if (priv->status & STATUS_RF_KILL_MASK) { | ||
8932 | IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); | ||
8933 | priv->status |= STATUS_SCAN_PENDING; | ||
8934 | goto done; | ||
8935 | } | ||
8936 | |||
8937 | IPW_DEBUG_HC("starting request direct scan!\n"); | ||
8938 | |||
8939 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { | ||
8940 | err = wait_event_interruptible(priv->wait_state, | ||
8941 | !(priv-> | ||
8942 | status & (STATUS_SCANNING | | ||
8943 | STATUS_SCAN_ABORTING))); | ||
8944 | if (err) { | ||
8945 | IPW_DEBUG_HC("aborting direct scan"); | ||
8946 | goto done; | ||
8947 | } | ||
8948 | } | ||
8949 | memset(&scan, 0, sizeof(scan)); | ||
8950 | |||
8951 | if (priv->config & CFG_SPEED_SCAN) | ||
8952 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
8953 | cpu_to_le16(30); | ||
8954 | else | ||
8955 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
8956 | cpu_to_le16(20); | ||
8957 | |||
8958 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = | ||
8959 | cpu_to_le16(20); | ||
8960 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); | ||
8961 | scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20); | ||
8962 | |||
8963 | scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); | ||
8964 | |||
8965 | err = ipw_send_ssid(priv, essid, essid_len); | ||
8966 | if (err) { | ||
8967 | IPW_DEBUG_HC("Attempt to send SSID command failed\n"); | ||
8968 | goto done; | ||
8969 | } | ||
8970 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; | ||
8971 | |||
8972 | ipw_add_scan_channels(priv, &scan, scan_type); | ||
8973 | |||
8974 | err = ipw_send_scan_request_ext(priv, &scan); | ||
8975 | if (err) { | ||
8976 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); | ||
8977 | goto done; | ||
8978 | } | ||
8979 | |||
8980 | priv->status |= STATUS_SCANNING; | ||
8981 | |||
8982 | done: | ||
8983 | up(&priv->sem); | ||
8984 | return err; | ||
5841 | } | 8985 | } |
5842 | 8986 | ||
5843 | static int ipw_wx_set_scan(struct net_device *dev, | 8987 | static int ipw_wx_set_scan(struct net_device *dev, |
@@ -5845,9 +8989,21 @@ static int ipw_wx_set_scan(struct net_device *dev, | |||
5845 | union iwreq_data *wrqu, char *extra) | 8989 | union iwreq_data *wrqu, char *extra) |
5846 | { | 8990 | { |
5847 | struct ipw_priv *priv = ieee80211_priv(dev); | 8991 | struct ipw_priv *priv = ieee80211_priv(dev); |
8992 | struct iw_scan_req *req = NULL; | ||
8993 | if (wrqu->data.length | ||
8994 | && wrqu->data.length == sizeof(struct iw_scan_req)) { | ||
8995 | req = (struct iw_scan_req *)extra; | ||
8996 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { | ||
8997 | ipw_request_direct_scan(priv, req->essid, | ||
8998 | req->essid_len); | ||
8999 | return 0; | ||
9000 | } | ||
9001 | } | ||
9002 | |||
5848 | IPW_DEBUG_WX("Start scan\n"); | 9003 | IPW_DEBUG_WX("Start scan\n"); |
5849 | if (ipw_request_scan(priv)) | 9004 | |
5850 | return -EIO; | 9005 | queue_work(priv->workqueue, &priv->request_scan); |
9006 | |||
5851 | return 0; | 9007 | return 0; |
5852 | } | 9008 | } |
5853 | 9009 | ||
@@ -5864,7 +9020,21 @@ static int ipw_wx_set_encode(struct net_device *dev, | |||
5864 | union iwreq_data *wrqu, char *key) | 9020 | union iwreq_data *wrqu, char *key) |
5865 | { | 9021 | { |
5866 | struct ipw_priv *priv = ieee80211_priv(dev); | 9022 | struct ipw_priv *priv = ieee80211_priv(dev); |
5867 | return ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); | 9023 | int ret; |
9024 | u32 cap = priv->capability; | ||
9025 | |||
9026 | down(&priv->sem); | ||
9027 | ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); | ||
9028 | |||
9029 | /* In IBSS mode, we need to notify the firmware to update | ||
9030 | * the beacon info after we changed the capability. */ | ||
9031 | if (cap != priv->capability && | ||
9032 | priv->ieee->iw_mode == IW_MODE_ADHOC && | ||
9033 | priv->status & STATUS_ASSOCIATED) | ||
9034 | ipw_disassociate(priv); | ||
9035 | |||
9036 | up(&priv->sem); | ||
9037 | return ret; | ||
5868 | } | 9038 | } |
5869 | 9039 | ||
5870 | static int ipw_wx_get_encode(struct net_device *dev, | 9040 | static int ipw_wx_get_encode(struct net_device *dev, |
@@ -5881,17 +9051,17 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5881 | { | 9051 | { |
5882 | struct ipw_priv *priv = ieee80211_priv(dev); | 9052 | struct ipw_priv *priv = ieee80211_priv(dev); |
5883 | int err; | 9053 | int err; |
5884 | 9054 | down(&priv->sem); | |
5885 | if (wrqu->power.disabled) { | 9055 | if (wrqu->power.disabled) { |
5886 | priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); | 9056 | priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); |
5887 | err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); | 9057 | err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); |
5888 | if (err) { | 9058 | if (err) { |
5889 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9059 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9060 | up(&priv->sem); | ||
5890 | return err; | 9061 | return err; |
5891 | } | 9062 | } |
5892 | |||
5893 | IPW_DEBUG_WX("SET Power Management Mode -> off\n"); | 9063 | IPW_DEBUG_WX("SET Power Management Mode -> off\n"); |
5894 | 9064 | up(&priv->sem); | |
5895 | return 0; | 9065 | return 0; |
5896 | } | 9066 | } |
5897 | 9067 | ||
@@ -5903,6 +9073,7 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5903 | default: /* Otherwise we don't support it */ | 9073 | default: /* Otherwise we don't support it */ |
5904 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", | 9074 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", |
5905 | wrqu->power.flags); | 9075 | wrqu->power.flags); |
9076 | up(&priv->sem); | ||
5906 | return -EOPNOTSUPP; | 9077 | return -EOPNOTSUPP; |
5907 | } | 9078 | } |
5908 | 9079 | ||
@@ -5915,11 +9086,12 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5915 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); | 9086 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); |
5916 | if (err) { | 9087 | if (err) { |
5917 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9088 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9089 | up(&priv->sem); | ||
5918 | return err; | 9090 | return err; |
5919 | } | 9091 | } |
5920 | 9092 | ||
5921 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); | 9093 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); |
5922 | 9094 | up(&priv->sem); | |
5923 | return 0; | 9095 | return 0; |
5924 | } | 9096 | } |
5925 | 9097 | ||
@@ -5928,13 +9100,13 @@ static int ipw_wx_get_power(struct net_device *dev, | |||
5928 | union iwreq_data *wrqu, char *extra) | 9100 | union iwreq_data *wrqu, char *extra) |
5929 | { | 9101 | { |
5930 | struct ipw_priv *priv = ieee80211_priv(dev); | 9102 | struct ipw_priv *priv = ieee80211_priv(dev); |
5931 | 9103 | down(&priv->sem); | |
5932 | if (!(priv->power_mode & IPW_POWER_ENABLED)) { | 9104 | if (!(priv->power_mode & IPW_POWER_ENABLED)) |
5933 | wrqu->power.disabled = 1; | 9105 | wrqu->power.disabled = 1; |
5934 | } else { | 9106 | else |
5935 | wrqu->power.disabled = 0; | 9107 | wrqu->power.disabled = 0; |
5936 | } | ||
5937 | 9108 | ||
9109 | up(&priv->sem); | ||
5938 | IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); | 9110 | IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); |
5939 | 9111 | ||
5940 | return 0; | 9112 | return 0; |
@@ -5947,7 +9119,7 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
5947 | struct ipw_priv *priv = ieee80211_priv(dev); | 9119 | struct ipw_priv *priv = ieee80211_priv(dev); |
5948 | int mode = *(int *)extra; | 9120 | int mode = *(int *)extra; |
5949 | int err; | 9121 | int err; |
5950 | 9122 | down(&priv->sem); | |
5951 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { | 9123 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { |
5952 | mode = IPW_POWER_AC; | 9124 | mode = IPW_POWER_AC; |
5953 | priv->power_mode = mode; | 9125 | priv->power_mode = mode; |
@@ -5960,10 +9132,11 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
5960 | 9132 | ||
5961 | if (err) { | 9133 | if (err) { |
5962 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9134 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9135 | up(&priv->sem); | ||
5963 | return err; | 9136 | return err; |
5964 | } | 9137 | } |
5965 | } | 9138 | } |
5966 | 9139 | up(&priv->sem); | |
5967 | return 0; | 9140 | return 0; |
5968 | } | 9141 | } |
5969 | 9142 | ||
@@ -6012,7 +9185,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
6012 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); | 9185 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); |
6013 | return -EINVAL; | 9186 | return -EINVAL; |
6014 | } | 9187 | } |
6015 | 9188 | down(&priv->sem); | |
6016 | if (priv->adapter == IPW_2915ABG) { | 9189 | if (priv->adapter == IPW_2915ABG) { |
6017 | priv->ieee->abg_true = 1; | 9190 | priv->ieee->abg_true = 1; |
6018 | if (mode & IEEE_A) { | 9191 | if (mode & IEEE_A) { |
@@ -6024,6 +9197,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
6024 | if (mode & IEEE_A) { | 9197 | if (mode & IEEE_A) { |
6025 | IPW_WARNING("Attempt to set 2200BG into " | 9198 | IPW_WARNING("Attempt to set 2200BG into " |
6026 | "802.11a mode\n"); | 9199 | "802.11a mode\n"); |
9200 | up(&priv->sem); | ||
6027 | return -EINVAL; | 9201 | return -EINVAL; |
6028 | } | 9202 | } |
6029 | 9203 | ||
@@ -6047,20 +9221,20 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
6047 | priv->ieee->modulation = modulation; | 9221 | priv->ieee->modulation = modulation; |
6048 | init_supported_rates(priv, &priv->rates); | 9222 | init_supported_rates(priv, &priv->rates); |
6049 | 9223 | ||
6050 | /* If we are currently associated, or trying to associate | 9224 | /* Network configuration changed -- force [re]association */ |
6051 | * then see if this is a new configuration (causing us to | 9225 | IPW_DEBUG_ASSOC("[re]association triggered due to mode change.\n"); |
6052 | * disassociate) */ | 9226 | if (!ipw_disassociate(priv)) { |
6053 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | ||
6054 | /* The resulting association will trigger | ||
6055 | * the new rates to be sent to the device */ | ||
6056 | IPW_DEBUG_ASSOC("Disassociating due to mode change.\n"); | ||
6057 | ipw_disassociate(priv); | ||
6058 | } else | ||
6059 | ipw_send_supported_rates(priv, &priv->rates); | 9227 | ipw_send_supported_rates(priv, &priv->rates); |
9228 | ipw_associate(priv); | ||
9229 | } | ||
9230 | |||
9231 | /* Update the band LEDs */ | ||
9232 | ipw_led_band_on(priv); | ||
6060 | 9233 | ||
6061 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", | 9234 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", |
6062 | mode & IEEE_A ? 'a' : '.', | 9235 | mode & IEEE_A ? 'a' : '.', |
6063 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); | 9236 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); |
9237 | up(&priv->sem); | ||
6064 | return 0; | 9238 | return 0; |
6065 | } | 9239 | } |
6066 | 9240 | ||
@@ -6069,124 +9243,234 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, | |||
6069 | union iwreq_data *wrqu, char *extra) | 9243 | union iwreq_data *wrqu, char *extra) |
6070 | { | 9244 | { |
6071 | struct ipw_priv *priv = ieee80211_priv(dev); | 9245 | struct ipw_priv *priv = ieee80211_priv(dev); |
6072 | 9246 | down(&priv->sem); | |
6073 | switch (priv->ieee->freq_band) { | 9247 | switch (priv->ieee->mode) { |
6074 | case IEEE80211_24GHZ_BAND: | 9248 | case IEEE_A: |
6075 | switch (priv->ieee->modulation) { | ||
6076 | case IEEE80211_CCK_MODULATION: | ||
6077 | strncpy(extra, "802.11b (2)", MAX_WX_STRING); | ||
6078 | break; | ||
6079 | case IEEE80211_OFDM_MODULATION: | ||
6080 | strncpy(extra, "802.11g (4)", MAX_WX_STRING); | ||
6081 | break; | ||
6082 | default: | ||
6083 | strncpy(extra, "802.11bg (6)", MAX_WX_STRING); | ||
6084 | break; | ||
6085 | } | ||
6086 | break; | ||
6087 | |||
6088 | case IEEE80211_52GHZ_BAND: | ||
6089 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); | 9249 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); |
6090 | break; | 9250 | break; |
6091 | 9251 | case IEEE_B: | |
6092 | default: /* Mixed Band */ | 9252 | strncpy(extra, "802.11b (2)", MAX_WX_STRING); |
6093 | switch (priv->ieee->modulation) { | 9253 | break; |
6094 | case IEEE80211_CCK_MODULATION: | 9254 | case IEEE_A | IEEE_B: |
6095 | strncpy(extra, "802.11ab (3)", MAX_WX_STRING); | 9255 | strncpy(extra, "802.11ab (3)", MAX_WX_STRING); |
6096 | break; | 9256 | break; |
6097 | case IEEE80211_OFDM_MODULATION: | 9257 | case IEEE_G: |
6098 | strncpy(extra, "802.11ag (5)", MAX_WX_STRING); | 9258 | strncpy(extra, "802.11g (4)", MAX_WX_STRING); |
6099 | break; | 9259 | break; |
6100 | default: | 9260 | case IEEE_A | IEEE_G: |
6101 | strncpy(extra, "802.11abg (7)", MAX_WX_STRING); | 9261 | strncpy(extra, "802.11ag (5)", MAX_WX_STRING); |
6102 | break; | 9262 | break; |
6103 | } | 9263 | case IEEE_B | IEEE_G: |
9264 | strncpy(extra, "802.11bg (6)", MAX_WX_STRING); | ||
9265 | break; | ||
9266 | case IEEE_A | IEEE_B | IEEE_G: | ||
9267 | strncpy(extra, "802.11abg (7)", MAX_WX_STRING); | ||
9268 | break; | ||
9269 | default: | ||
9270 | strncpy(extra, "unknown", MAX_WX_STRING); | ||
6104 | break; | 9271 | break; |
6105 | } | 9272 | } |
6106 | 9273 | ||
6107 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); | 9274 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); |
6108 | 9275 | ||
6109 | wrqu->data.length = strlen(extra) + 1; | 9276 | wrqu->data.length = strlen(extra) + 1; |
9277 | up(&priv->sem); | ||
6110 | 9278 | ||
6111 | return 0; | 9279 | return 0; |
6112 | } | 9280 | } |
6113 | 9281 | ||
6114 | #ifdef CONFIG_IPW_PROMISC | 9282 | static int ipw_wx_set_preamble(struct net_device *dev, |
6115 | static int ipw_wx_set_promisc(struct net_device *dev, | 9283 | struct iw_request_info *info, |
9284 | union iwreq_data *wrqu, char *extra) | ||
9285 | { | ||
9286 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
9287 | int mode = *(int *)extra; | ||
9288 | down(&priv->sem); | ||
9289 | /* Switching from SHORT -> LONG requires a disassociation */ | ||
9290 | if (mode == 1) { | ||
9291 | if (!(priv->config & CFG_PREAMBLE_LONG)) { | ||
9292 | priv->config |= CFG_PREAMBLE_LONG; | ||
9293 | |||
9294 | /* Network configuration changed -- force [re]association */ | ||
9295 | IPW_DEBUG_ASSOC | ||
9296 | ("[re]association triggered due to preamble change.\n"); | ||
9297 | if (!ipw_disassociate(priv)) | ||
9298 | ipw_associate(priv); | ||
9299 | } | ||
9300 | goto done; | ||
9301 | } | ||
9302 | |||
9303 | if (mode == 0) { | ||
9304 | priv->config &= ~CFG_PREAMBLE_LONG; | ||
9305 | goto done; | ||
9306 | } | ||
9307 | up(&priv->sem); | ||
9308 | return -EINVAL; | ||
9309 | |||
9310 | done: | ||
9311 | up(&priv->sem); | ||
9312 | return 0; | ||
9313 | } | ||
9314 | |||
9315 | static int ipw_wx_get_preamble(struct net_device *dev, | ||
9316 | struct iw_request_info *info, | ||
9317 | union iwreq_data *wrqu, char *extra) | ||
9318 | { | ||
9319 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
9320 | down(&priv->sem); | ||
9321 | if (priv->config & CFG_PREAMBLE_LONG) | ||
9322 | snprintf(wrqu->name, IFNAMSIZ, "long (1)"); | ||
9323 | else | ||
9324 | snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); | ||
9325 | up(&priv->sem); | ||
9326 | return 0; | ||
9327 | } | ||
9328 | |||
9329 | #ifdef CONFIG_IPW2200_MONITOR | ||
9330 | static int ipw_wx_set_monitor(struct net_device *dev, | ||
6116 | struct iw_request_info *info, | 9331 | struct iw_request_info *info, |
6117 | union iwreq_data *wrqu, char *extra) | 9332 | union iwreq_data *wrqu, char *extra) |
6118 | { | 9333 | { |
6119 | struct ipw_priv *priv = ieee80211_priv(dev); | 9334 | struct ipw_priv *priv = ieee80211_priv(dev); |
6120 | int *parms = (int *)extra; | 9335 | int *parms = (int *)extra; |
6121 | int enable = (parms[0] > 0); | 9336 | int enable = (parms[0] > 0); |
6122 | 9337 | down(&priv->sem); | |
6123 | IPW_DEBUG_WX("SET PROMISC: %d %d\n", enable, parms[1]); | 9338 | IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); |
6124 | if (enable) { | 9339 | if (enable) { |
6125 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { | 9340 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { |
9341 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
9342 | priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
9343 | #else | ||
6126 | priv->net_dev->type = ARPHRD_IEEE80211; | 9344 | priv->net_dev->type = ARPHRD_IEEE80211; |
6127 | ipw_adapter_restart(priv); | 9345 | #endif |
9346 | queue_work(priv->workqueue, &priv->adapter_restart); | ||
6128 | } | 9347 | } |
6129 | 9348 | ||
6130 | ipw_set_channel(priv, parms[1]); | 9349 | ipw_set_channel(priv, parms[1]); |
6131 | } else { | 9350 | } else { |
6132 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) | 9351 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { |
9352 | up(&priv->sem); | ||
6133 | return 0; | 9353 | return 0; |
9354 | } | ||
6134 | priv->net_dev->type = ARPHRD_ETHER; | 9355 | priv->net_dev->type = ARPHRD_ETHER; |
6135 | ipw_adapter_restart(priv); | 9356 | queue_work(priv->workqueue, &priv->adapter_restart); |
6136 | } | 9357 | } |
9358 | up(&priv->sem); | ||
6137 | return 0; | 9359 | return 0; |
6138 | } | 9360 | } |
6139 | 9361 | ||
9362 | #endif // CONFIG_IPW2200_MONITOR | ||
9363 | |||
6140 | static int ipw_wx_reset(struct net_device *dev, | 9364 | static int ipw_wx_reset(struct net_device *dev, |
6141 | struct iw_request_info *info, | 9365 | struct iw_request_info *info, |
6142 | union iwreq_data *wrqu, char *extra) | 9366 | union iwreq_data *wrqu, char *extra) |
6143 | { | 9367 | { |
6144 | struct ipw_priv *priv = ieee80211_priv(dev); | 9368 | struct ipw_priv *priv = ieee80211_priv(dev); |
6145 | IPW_DEBUG_WX("RESET\n"); | 9369 | IPW_DEBUG_WX("RESET\n"); |
6146 | ipw_adapter_restart(priv); | 9370 | queue_work(priv->workqueue, &priv->adapter_restart); |
9371 | return 0; | ||
9372 | } | ||
9373 | |||
9374 | static int ipw_wx_sw_reset(struct net_device *dev, | ||
9375 | struct iw_request_info *info, | ||
9376 | union iwreq_data *wrqu, char *extra) | ||
9377 | { | ||
9378 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
9379 | union iwreq_data wrqu_sec = { | ||
9380 | .encoding = { | ||
9381 | .flags = IW_ENCODE_DISABLED, | ||
9382 | }, | ||
9383 | }; | ||
9384 | int ret; | ||
9385 | |||
9386 | IPW_DEBUG_WX("SW_RESET\n"); | ||
9387 | |||
9388 | down(&priv->sem); | ||
9389 | |||
9390 | ret = ipw_sw_reset(priv, 0); | ||
9391 | if (!ret) { | ||
9392 | free_firmware(); | ||
9393 | ipw_adapter_restart(priv); | ||
9394 | } | ||
9395 | |||
9396 | /* The SW reset bit might have been toggled on by the 'disable' | ||
9397 | * module parameter, so take appropriate action */ | ||
9398 | ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); | ||
9399 | |||
9400 | up(&priv->sem); | ||
9401 | ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); | ||
9402 | down(&priv->sem); | ||
9403 | |||
9404 | if (!(priv->status & STATUS_RF_KILL_MASK)) { | ||
9405 | /* Configuration likely changed -- force [re]association */ | ||
9406 | IPW_DEBUG_ASSOC("[re]association triggered due to sw " | ||
9407 | "reset.\n"); | ||
9408 | if (!ipw_disassociate(priv)) | ||
9409 | ipw_associate(priv); | ||
9410 | } | ||
9411 | |||
9412 | up(&priv->sem); | ||
9413 | |||
6147 | return 0; | 9414 | return 0; |
6148 | } | 9415 | } |
6149 | #endif // CONFIG_IPW_PROMISC | ||
6150 | 9416 | ||
6151 | /* Rebase the WE IOCTLs to zero for the handler array */ | 9417 | /* Rebase the WE IOCTLs to zero for the handler array */ |
6152 | #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] | 9418 | #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] |
6153 | static iw_handler ipw_wx_handlers[] = { | 9419 | static iw_handler ipw_wx_handlers[] = { |
6154 | IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, | 9420 | IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, |
6155 | IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, | 9421 | IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, |
6156 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, | 9422 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, |
6157 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, | 9423 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, |
6158 | IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, | 9424 | IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, |
6159 | IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, | 9425 | IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, |
6160 | IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, | 9426 | IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, |
6161 | IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, | 9427 | IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, |
6162 | IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan, | 9428 | IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan, |
6163 | IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan, | 9429 | IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan, |
6164 | IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid, | 9430 | IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid, |
6165 | IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid, | 9431 | IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid, |
6166 | IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick, | 9432 | IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick, |
6167 | IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick, | 9433 | IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick, |
6168 | IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate, | 9434 | IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate, |
6169 | IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate, | 9435 | IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate, |
6170 | IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts, | 9436 | IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts, |
6171 | IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts, | 9437 | IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts, |
6172 | IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag, | 9438 | IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag, |
6173 | IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag, | 9439 | IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag, |
6174 | IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow, | 9440 | IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow, |
6175 | IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow, | 9441 | IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow, |
6176 | IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry, | 9442 | IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry, |
6177 | IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry, | 9443 | IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry, |
6178 | IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode, | 9444 | IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode, |
6179 | IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, | 9445 | IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, |
6180 | IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, | 9446 | IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, |
6181 | IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, | 9447 | IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, |
9448 | IW_IOCTL(SIOCSIWSPY) = iw_handler_set_spy, | ||
9449 | IW_IOCTL(SIOCGIWSPY) = iw_handler_get_spy, | ||
9450 | IW_IOCTL(SIOCSIWTHRSPY) = iw_handler_set_thrspy, | ||
9451 | IW_IOCTL(SIOCGIWTHRSPY) = iw_handler_get_thrspy, | ||
9452 | IW_IOCTL(SIOCSIWGENIE) = ipw_wx_set_genie, | ||
9453 | IW_IOCTL(SIOCGIWGENIE) = ipw_wx_get_genie, | ||
9454 | IW_IOCTL(SIOCSIWMLME) = ipw_wx_set_mlme, | ||
9455 | IW_IOCTL(SIOCSIWAUTH) = ipw_wx_set_auth, | ||
9456 | IW_IOCTL(SIOCGIWAUTH) = ipw_wx_get_auth, | ||
9457 | IW_IOCTL(SIOCSIWENCODEEXT) = ipw_wx_set_encodeext, | ||
9458 | IW_IOCTL(SIOCGIWENCODEEXT) = ipw_wx_get_encodeext, | ||
6182 | }; | 9459 | }; |
6183 | 9460 | ||
6184 | #define IPW_PRIV_SET_POWER SIOCIWFIRSTPRIV | 9461 | enum { |
6185 | #define IPW_PRIV_GET_POWER SIOCIWFIRSTPRIV+1 | 9462 | IPW_PRIV_SET_POWER = SIOCIWFIRSTPRIV, |
6186 | #define IPW_PRIV_SET_MODE SIOCIWFIRSTPRIV+2 | 9463 | IPW_PRIV_GET_POWER, |
6187 | #define IPW_PRIV_GET_MODE SIOCIWFIRSTPRIV+3 | 9464 | IPW_PRIV_SET_MODE, |
6188 | #define IPW_PRIV_SET_PROMISC SIOCIWFIRSTPRIV+4 | 9465 | IPW_PRIV_GET_MODE, |
6189 | #define IPW_PRIV_RESET SIOCIWFIRSTPRIV+5 | 9466 | IPW_PRIV_SET_PREAMBLE, |
9467 | IPW_PRIV_GET_PREAMBLE, | ||
9468 | IPW_PRIV_RESET, | ||
9469 | IPW_PRIV_SW_RESET, | ||
9470 | #ifdef CONFIG_IPW2200_MONITOR | ||
9471 | IPW_PRIV_SET_MONITOR, | ||
9472 | #endif | ||
9473 | }; | ||
6190 | 9474 | ||
6191 | static struct iw_priv_args ipw_priv_args[] = { | 9475 | static struct iw_priv_args ipw_priv_args[] = { |
6192 | { | 9476 | { |
@@ -6205,14 +9489,25 @@ static struct iw_priv_args ipw_priv_args[] = { | |||
6205 | .cmd = IPW_PRIV_GET_MODE, | 9489 | .cmd = IPW_PRIV_GET_MODE, |
6206 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, | 9490 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, |
6207 | .name = "get_mode"}, | 9491 | .name = "get_mode"}, |
6208 | #ifdef CONFIG_IPW_PROMISC | ||
6209 | { | 9492 | { |
6210 | IPW_PRIV_SET_PROMISC, | 9493 | .cmd = IPW_PRIV_SET_PREAMBLE, |
6211 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, | 9494 | .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
9495 | .name = "set_preamble"}, | ||
9496 | { | ||
9497 | .cmd = IPW_PRIV_GET_PREAMBLE, | ||
9498 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, | ||
9499 | .name = "get_preamble"}, | ||
6212 | { | 9500 | { |
6213 | IPW_PRIV_RESET, | 9501 | IPW_PRIV_RESET, |
6214 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, | 9502 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, |
6215 | #endif /* CONFIG_IPW_PROMISC */ | 9503 | { |
9504 | IPW_PRIV_SW_RESET, | ||
9505 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "sw_reset"}, | ||
9506 | #ifdef CONFIG_IPW2200_MONITOR | ||
9507 | { | ||
9508 | IPW_PRIV_SET_MONITOR, | ||
9509 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, | ||
9510 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
6216 | }; | 9511 | }; |
6217 | 9512 | ||
6218 | static iw_handler ipw_priv_handler[] = { | 9513 | static iw_handler ipw_priv_handler[] = { |
@@ -6220,19 +9515,23 @@ static iw_handler ipw_priv_handler[] = { | |||
6220 | ipw_wx_get_powermode, | 9515 | ipw_wx_get_powermode, |
6221 | ipw_wx_set_wireless_mode, | 9516 | ipw_wx_set_wireless_mode, |
6222 | ipw_wx_get_wireless_mode, | 9517 | ipw_wx_get_wireless_mode, |
6223 | #ifdef CONFIG_IPW_PROMISC | 9518 | ipw_wx_set_preamble, |
6224 | ipw_wx_set_promisc, | 9519 | ipw_wx_get_preamble, |
6225 | ipw_wx_reset, | 9520 | ipw_wx_reset, |
9521 | ipw_wx_sw_reset, | ||
9522 | #ifdef CONFIG_IPW2200_MONITOR | ||
9523 | ipw_wx_set_monitor, | ||
6226 | #endif | 9524 | #endif |
6227 | }; | 9525 | }; |
6228 | 9526 | ||
6229 | static struct iw_handler_def ipw_wx_handler_def = { | 9527 | static struct iw_handler_def ipw_wx_handler_def = { |
6230 | .standard = ipw_wx_handlers, | 9528 | .standard = ipw_wx_handlers, |
6231 | .num_standard = ARRAY_SIZE(ipw_wx_handlers), | 9529 | .num_standard = ARRAY_SIZE(ipw_wx_handlers), |
6232 | .num_private = ARRAY_SIZE(ipw_priv_handler), | 9530 | .num_private = ARRAY_SIZE(ipw_priv_handler), |
6233 | .num_private_args = ARRAY_SIZE(ipw_priv_args), | 9531 | .num_private_args = ARRAY_SIZE(ipw_priv_args), |
6234 | .private = ipw_priv_handler, | 9532 | .private = ipw_priv_handler, |
6235 | .private_args = ipw_priv_args, | 9533 | .private_args = ipw_priv_args, |
9534 | .get_wireless_stats = ipw_get_wireless_stats, | ||
6236 | }; | 9535 | }; |
6237 | 9536 | ||
6238 | /* | 9537 | /* |
@@ -6247,8 +9546,8 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) | |||
6247 | 9546 | ||
6248 | wstats = &priv->wstats; | 9547 | wstats = &priv->wstats; |
6249 | 9548 | ||
6250 | /* if hw is disabled, then ipw2100_get_ordinal() can't be called. | 9549 | /* if hw is disabled, then ipw_get_ordinal() can't be called. |
6251 | * ipw2100_wx_wireless_stats seems to be called before fw is | 9550 | * netdev->get_wireless_stats seems to be called before fw is |
6252 | * initialized. STATUS_ASSOCIATED will only be set if the hw is up | 9551 | * initialized. STATUS_ASSOCIATED will only be set if the hw is up |
6253 | * and associated; if not associcated, the values are all meaningless | 9552 | * and associated; if not associcated, the values are all meaningless |
6254 | * anyway, so set them all to NULL and INVALID */ | 9553 | * anyway, so set them all to NULL and INVALID */ |
@@ -6299,7 +9598,7 @@ static inline void init_sys_config(struct ipw_sys_config *sys_config) | |||
6299 | sys_config->dot11g_auto_detection = 0; | 9598 | sys_config->dot11g_auto_detection = 0; |
6300 | sys_config->enable_cts_to_self = 0; | 9599 | sys_config->enable_cts_to_self = 0; |
6301 | sys_config->bt_coexist_collision_thr = 0; | 9600 | sys_config->bt_coexist_collision_thr = 0; |
6302 | sys_config->pass_noise_stats_to_host = 1; | 9601 | sys_config->pass_noise_stats_to_host = 1; //1 -- fix for 256 |
6303 | } | 9602 | } |
6304 | 9603 | ||
6305 | static int ipw_net_open(struct net_device *dev) | 9604 | static int ipw_net_open(struct net_device *dev) |
@@ -6307,9 +9606,11 @@ static int ipw_net_open(struct net_device *dev) | |||
6307 | struct ipw_priv *priv = ieee80211_priv(dev); | 9606 | struct ipw_priv *priv = ieee80211_priv(dev); |
6308 | IPW_DEBUG_INFO("dev->open\n"); | 9607 | IPW_DEBUG_INFO("dev->open\n"); |
6309 | /* we should be verifying the device is ready to be opened */ | 9608 | /* we should be verifying the device is ready to be opened */ |
9609 | down(&priv->sem); | ||
6310 | if (!(priv->status & STATUS_RF_KILL_MASK) && | 9610 | if (!(priv->status & STATUS_RF_KILL_MASK) && |
6311 | (priv->status & STATUS_ASSOCIATED)) | 9611 | (priv->status & STATUS_ASSOCIATED)) |
6312 | netif_start_queue(dev); | 9612 | netif_start_queue(dev); |
9613 | up(&priv->sem); | ||
6313 | return 0; | 9614 | return 0; |
6314 | } | 9615 | } |
6315 | 9616 | ||
@@ -6327,22 +9628,34 @@ modify to send one tfd per fragment instead of using chunking. otherwise | |||
6327 | we need to heavily modify the ieee80211_skb_to_txb. | 9628 | we need to heavily modify the ieee80211_skb_to_txb. |
6328 | */ | 9629 | */ |
6329 | 9630 | ||
6330 | static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | 9631 | static inline int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, |
9632 | int pri) | ||
6331 | { | 9633 | { |
6332 | struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) | 9634 | struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) |
6333 | txb->fragments[0]->data; | 9635 | txb->fragments[0]->data; |
6334 | int i = 0; | 9636 | int i = 0; |
6335 | struct tfd_frame *tfd; | 9637 | struct tfd_frame *tfd; |
9638 | #ifdef CONFIG_IPW_QOS | ||
9639 | int tx_id = ipw_get_tx_queue_number(priv, pri); | ||
9640 | struct clx2_tx_queue *txq = &priv->txq[tx_id]; | ||
9641 | #else | ||
6336 | struct clx2_tx_queue *txq = &priv->txq[0]; | 9642 | struct clx2_tx_queue *txq = &priv->txq[0]; |
9643 | #endif | ||
6337 | struct clx2_queue *q = &txq->q; | 9644 | struct clx2_queue *q = &txq->q; |
6338 | u8 id, hdr_len, unicast; | 9645 | u8 id, hdr_len, unicast; |
6339 | u16 remaining_bytes; | 9646 | u16 remaining_bytes; |
9647 | int fc; | ||
9648 | |||
9649 | /* If there isn't room in the queue, we return busy and let the | ||
9650 | * network stack requeue the packet for us */ | ||
9651 | if (ipw_queue_space(q) < q->high_mark) | ||
9652 | return NETDEV_TX_BUSY; | ||
6340 | 9653 | ||
6341 | switch (priv->ieee->iw_mode) { | 9654 | switch (priv->ieee->iw_mode) { |
6342 | case IW_MODE_ADHOC: | 9655 | case IW_MODE_ADHOC: |
6343 | hdr_len = IEEE80211_3ADDR_LEN; | 9656 | hdr_len = IEEE80211_3ADDR_LEN; |
6344 | unicast = !is_broadcast_ether_addr(hdr->addr1) && | 9657 | unicast = !(is_multicast_ether_addr(hdr->addr1) || |
6345 | !is_multicast_ether_addr(hdr->addr1); | 9658 | is_broadcast_ether_addr(hdr->addr1)); |
6346 | id = ipw_find_station(priv, hdr->addr1); | 9659 | id = ipw_find_station(priv, hdr->addr1); |
6347 | if (id == IPW_INVALID_STATION) { | 9660 | if (id == IPW_INVALID_STATION) { |
6348 | id = ipw_add_station(priv, hdr->addr1); | 9661 | id = ipw_add_station(priv, hdr->addr1); |
@@ -6357,8 +9670,8 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6357 | 9670 | ||
6358 | case IW_MODE_INFRA: | 9671 | case IW_MODE_INFRA: |
6359 | default: | 9672 | default: |
6360 | unicast = !is_broadcast_ether_addr(hdr->addr3) && | 9673 | unicast = !(is_multicast_ether_addr(hdr->addr3) || |
6361 | !is_multicast_ether_addr(hdr->addr3); | 9674 | is_broadcast_ether_addr(hdr->addr3)); |
6362 | hdr_len = IEEE80211_3ADDR_LEN; | 9675 | hdr_len = IEEE80211_3ADDR_LEN; |
6363 | id = 0; | 9676 | id = 0; |
6364 | break; | 9677 | break; |
@@ -6373,26 +9686,83 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6373 | tfd->control_flags.control_bits = TFD_NEED_IRQ_MASK; | 9686 | tfd->control_flags.control_bits = TFD_NEED_IRQ_MASK; |
6374 | 9687 | ||
6375 | tfd->u.data.cmd_id = DINO_CMD_TX; | 9688 | tfd->u.data.cmd_id = DINO_CMD_TX; |
6376 | tfd->u.data.len = txb->payload_size; | 9689 | tfd->u.data.len = cpu_to_le16(txb->payload_size); |
6377 | remaining_bytes = txb->payload_size; | 9690 | remaining_bytes = txb->payload_size; |
6378 | if (unlikely(!unicast)) | ||
6379 | tfd->u.data.tx_flags = DCT_FLAG_NO_WEP; | ||
6380 | else | ||
6381 | tfd->u.data.tx_flags = DCT_FLAG_NO_WEP | DCT_FLAG_ACK_REQD; | ||
6382 | 9691 | ||
6383 | if (priv->assoc_request.ieee_mode == IPW_B_MODE) | 9692 | if (priv->assoc_request.ieee_mode == IPW_B_MODE) |
6384 | tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_CCK; | 9693 | tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_MODE_CCK; |
6385 | else | 9694 | else |
6386 | tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_OFDM; | 9695 | tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_MODE_OFDM; |
6387 | 9696 | ||
6388 | if (priv->config & CFG_PREAMBLE) | 9697 | if (priv->assoc_request.preamble_length == DCT_FLAG_SHORT_PREAMBLE) |
6389 | tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREMBL; | 9698 | tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREAMBLE; |
9699 | |||
9700 | fc = le16_to_cpu(hdr->frame_ctl); | ||
9701 | hdr->frame_ctl = cpu_to_le16(fc & ~IEEE80211_FCTL_MOREFRAGS); | ||
6390 | 9702 | ||
6391 | memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); | 9703 | memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); |
6392 | 9704 | ||
9705 | if (likely(unicast)) | ||
9706 | tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD; | ||
9707 | |||
9708 | if (txb->encrypted && !priv->ieee->host_encrypt) { | ||
9709 | switch (priv->ieee->sec.level) { | ||
9710 | case SEC_LEVEL_3: | ||
9711 | tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= | ||
9712 | IEEE80211_FCTL_PROTECTED; | ||
9713 | /* XXX: ACK flag must be set for CCMP even if it | ||
9714 | * is a multicast/broadcast packet, because CCMP | ||
9715 | * group communication encrypted by GTK is | ||
9716 | * actually done by the AP. */ | ||
9717 | if (!unicast) | ||
9718 | tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD; | ||
9719 | |||
9720 | tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; | ||
9721 | tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_CCM; | ||
9722 | tfd->u.data.key_index = 0; | ||
9723 | tfd->u.data.key_index |= DCT_WEP_INDEX_USE_IMMEDIATE; | ||
9724 | break; | ||
9725 | case SEC_LEVEL_2: | ||
9726 | tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= | ||
9727 | IEEE80211_FCTL_PROTECTED; | ||
9728 | tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; | ||
9729 | tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_TKIP; | ||
9730 | tfd->u.data.key_index = DCT_WEP_INDEX_USE_IMMEDIATE; | ||
9731 | break; | ||
9732 | case SEC_LEVEL_1: | ||
9733 | tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= | ||
9734 | IEEE80211_FCTL_PROTECTED; | ||
9735 | tfd->u.data.key_index = priv->ieee->tx_keyidx; | ||
9736 | if (priv->ieee->sec.key_sizes[priv->ieee->tx_keyidx] <= | ||
9737 | 40) | ||
9738 | tfd->u.data.key_index |= DCT_WEP_KEY_64Bit; | ||
9739 | else | ||
9740 | tfd->u.data.key_index |= DCT_WEP_KEY_128Bit; | ||
9741 | break; | ||
9742 | case SEC_LEVEL_0: | ||
9743 | break; | ||
9744 | default: | ||
9745 | printk(KERN_ERR "Unknow security level %d\n", | ||
9746 | priv->ieee->sec.level); | ||
9747 | break; | ||
9748 | } | ||
9749 | } else | ||
9750 | /* No hardware encryption */ | ||
9751 | tfd->u.data.tx_flags |= DCT_FLAG_NO_WEP; | ||
9752 | |||
9753 | #ifdef CONFIG_IPW_QOS | ||
9754 | ipw_qos_set_tx_queue_command(priv, pri, &(tfd->u.data), unicast); | ||
9755 | #endif /* CONFIG_IPW_QOS */ | ||
9756 | |||
6393 | /* payload */ | 9757 | /* payload */ |
6394 | tfd->u.data.num_chunks = min((u8) (NUM_TFD_CHUNKS - 2), txb->nr_frags); | 9758 | tfd->u.data.num_chunks = cpu_to_le32(min((u8) (NUM_TFD_CHUNKS - 2), |
6395 | for (i = 0; i < tfd->u.data.num_chunks; i++) { | 9759 | txb->nr_frags)); |
9760 | IPW_DEBUG_FRAG("%i fragments being sent as %i chunks.\n", | ||
9761 | txb->nr_frags, le32_to_cpu(tfd->u.data.num_chunks)); | ||
9762 | for (i = 0; i < le32_to_cpu(tfd->u.data.num_chunks); i++) { | ||
9763 | IPW_DEBUG_FRAG("Adding fragment %i of %i (%d bytes).\n", | ||
9764 | i, le32_to_cpu(tfd->u.data.num_chunks), | ||
9765 | txb->fragments[i]->len - hdr_len); | ||
6396 | IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", | 9766 | IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", |
6397 | i, tfd->u.data.num_chunks, | 9767 | i, tfd->u.data.num_chunks, |
6398 | txb->fragments[i]->len - hdr_len); | 9768 | txb->fragments[i]->len - hdr_len); |
@@ -6400,11 +9770,13 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6400 | txb->fragments[i]->len - hdr_len); | 9770 | txb->fragments[i]->len - hdr_len); |
6401 | 9771 | ||
6402 | tfd->u.data.chunk_ptr[i] = | 9772 | tfd->u.data.chunk_ptr[i] = |
6403 | pci_map_single(priv->pci_dev, | 9773 | cpu_to_le32(pci_map_single |
6404 | txb->fragments[i]->data + hdr_len, | 9774 | (priv->pci_dev, |
6405 | txb->fragments[i]->len - hdr_len, | 9775 | txb->fragments[i]->data + hdr_len, |
6406 | PCI_DMA_TODEVICE); | 9776 | txb->fragments[i]->len - hdr_len, |
6407 | tfd->u.data.chunk_len[i] = txb->fragments[i]->len - hdr_len; | 9777 | PCI_DMA_TODEVICE)); |
9778 | tfd->u.data.chunk_len[i] = | ||
9779 | cpu_to_le16(txb->fragments[i]->len - hdr_len); | ||
6408 | } | 9780 | } |
6409 | 9781 | ||
6410 | if (i != txb->nr_frags) { | 9782 | if (i != txb->nr_frags) { |
@@ -6419,9 +9791,10 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6419 | remaining_bytes); | 9791 | remaining_bytes); |
6420 | skb = alloc_skb(remaining_bytes, GFP_ATOMIC); | 9792 | skb = alloc_skb(remaining_bytes, GFP_ATOMIC); |
6421 | if (skb != NULL) { | 9793 | if (skb != NULL) { |
6422 | tfd->u.data.chunk_len[i] = remaining_bytes; | 9794 | tfd->u.data.chunk_len[i] = cpu_to_le16(remaining_bytes); |
6423 | for (j = i; j < txb->nr_frags; j++) { | 9795 | for (j = i; j < txb->nr_frags; j++) { |
6424 | int size = txb->fragments[j]->len - hdr_len; | 9796 | int size = txb->fragments[j]->len - hdr_len; |
9797 | |||
6425 | printk(KERN_INFO "Adding frag %d %d...\n", | 9798 | printk(KERN_INFO "Adding frag %d %d...\n", |
6426 | j, size); | 9799 | j, size); |
6427 | memcpy(skb_put(skb, size), | 9800 | memcpy(skb_put(skb, size), |
@@ -6430,10 +9803,14 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6430 | dev_kfree_skb_any(txb->fragments[i]); | 9803 | dev_kfree_skb_any(txb->fragments[i]); |
6431 | txb->fragments[i] = skb; | 9804 | txb->fragments[i] = skb; |
6432 | tfd->u.data.chunk_ptr[i] = | 9805 | tfd->u.data.chunk_ptr[i] = |
6433 | pci_map_single(priv->pci_dev, skb->data, | 9806 | cpu_to_le32(pci_map_single |
6434 | tfd->u.data.chunk_len[i], | 9807 | (priv->pci_dev, skb->data, |
6435 | PCI_DMA_TODEVICE); | 9808 | tfd->u.data.chunk_len[i], |
6436 | tfd->u.data.num_chunks++; | 9809 | PCI_DMA_TODEVICE)); |
9810 | |||
9811 | tfd->u.data.num_chunks = | ||
9812 | cpu_to_le32(le32_to_cpu(tfd->u.data.num_chunks) + | ||
9813 | 1); | ||
6437 | } | 9814 | } |
6438 | } | 9815 | } |
6439 | 9816 | ||
@@ -6441,14 +9818,28 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6441 | q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); | 9818 | q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); |
6442 | ipw_write32(priv, q->reg_w, q->first_empty); | 9819 | ipw_write32(priv, q->reg_w, q->first_empty); |
6443 | 9820 | ||
6444 | if (ipw_queue_space(q) < q->high_mark) | 9821 | return NETDEV_TX_OK; |
6445 | netif_stop_queue(priv->net_dev); | ||
6446 | |||
6447 | return; | ||
6448 | 9822 | ||
6449 | drop: | 9823 | drop: |
6450 | IPW_DEBUG_DROP("Silently dropping Tx packet.\n"); | 9824 | IPW_DEBUG_DROP("Silently dropping Tx packet.\n"); |
6451 | ieee80211_txb_free(txb); | 9825 | ieee80211_txb_free(txb); |
9826 | return NETDEV_TX_OK; | ||
9827 | } | ||
9828 | |||
9829 | static int ipw_net_is_queue_full(struct net_device *dev, int pri) | ||
9830 | { | ||
9831 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
9832 | #ifdef CONFIG_IPW_QOS | ||
9833 | int tx_id = ipw_get_tx_queue_number(priv, pri); | ||
9834 | struct clx2_tx_queue *txq = &priv->txq[tx_id]; | ||
9835 | #else | ||
9836 | struct clx2_tx_queue *txq = &priv->txq[0]; | ||
9837 | #endif /* CONFIG_IPW_QOS */ | ||
9838 | |||
9839 | if (ipw_queue_space(&txq->q) < txq->q.high_mark) | ||
9840 | return 1; | ||
9841 | |||
9842 | return 0; | ||
6452 | } | 9843 | } |
6453 | 9844 | ||
6454 | static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | 9845 | static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, |
@@ -6456,9 +9847,9 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | |||
6456 | { | 9847 | { |
6457 | struct ipw_priv *priv = ieee80211_priv(dev); | 9848 | struct ipw_priv *priv = ieee80211_priv(dev); |
6458 | unsigned long flags; | 9849 | unsigned long flags; |
9850 | int ret; | ||
6459 | 9851 | ||
6460 | IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size); | 9852 | IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size); |
6461 | |||
6462 | spin_lock_irqsave(&priv->lock, flags); | 9853 | spin_lock_irqsave(&priv->lock, flags); |
6463 | 9854 | ||
6464 | if (!(priv->status & STATUS_ASSOCIATED)) { | 9855 | if (!(priv->status & STATUS_ASSOCIATED)) { |
@@ -6468,10 +9859,12 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | |||
6468 | goto fail_unlock; | 9859 | goto fail_unlock; |
6469 | } | 9860 | } |
6470 | 9861 | ||
6471 | ipw_tx_skb(priv, txb); | 9862 | ret = ipw_tx_skb(priv, txb, pri); |
6472 | 9863 | if (ret == NETDEV_TX_OK) | |
9864 | __ipw_led_activity_on(priv); | ||
6473 | spin_unlock_irqrestore(&priv->lock, flags); | 9865 | spin_unlock_irqrestore(&priv->lock, flags); |
6474 | return 0; | 9866 | |
9867 | return ret; | ||
6475 | 9868 | ||
6476 | fail_unlock: | 9869 | fail_unlock: |
6477 | spin_unlock_irqrestore(&priv->lock, flags); | 9870 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -6498,11 +9891,13 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p) | |||
6498 | struct sockaddr *addr = p; | 9891 | struct sockaddr *addr = p; |
6499 | if (!is_valid_ether_addr(addr->sa_data)) | 9892 | if (!is_valid_ether_addr(addr->sa_data)) |
6500 | return -EADDRNOTAVAIL; | 9893 | return -EADDRNOTAVAIL; |
9894 | down(&priv->sem); | ||
6501 | priv->config |= CFG_CUSTOM_MAC; | 9895 | priv->config |= CFG_CUSTOM_MAC; |
6502 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); | 9896 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); |
6503 | printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", | 9897 | printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", |
6504 | priv->net_dev->name, MAC_ARG(priv->mac_addr)); | 9898 | priv->net_dev->name, MAC_ARG(priv->mac_addr)); |
6505 | ipw_adapter_restart(priv); | 9899 | queue_work(priv->workqueue, &priv->adapter_restart); |
9900 | up(&priv->sem); | ||
6506 | return 0; | 9901 | return 0; |
6507 | } | 9902 | } |
6508 | 9903 | ||
@@ -6525,7 +9920,7 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, | |||
6525 | snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", | 9920 | snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", |
6526 | vers, date); | 9921 | vers, date); |
6527 | strcpy(info->bus_info, pci_name(p->pci_dev)); | 9922 | strcpy(info->bus_info, pci_name(p->pci_dev)); |
6528 | info->eedump_len = CX2_EEPROM_IMAGE_SIZE; | 9923 | info->eedump_len = IPW_EEPROM_IMAGE_SIZE; |
6529 | } | 9924 | } |
6530 | 9925 | ||
6531 | static u32 ipw_ethtool_get_link(struct net_device *dev) | 9926 | static u32 ipw_ethtool_get_link(struct net_device *dev) |
@@ -6536,7 +9931,7 @@ static u32 ipw_ethtool_get_link(struct net_device *dev) | |||
6536 | 9931 | ||
6537 | static int ipw_ethtool_get_eeprom_len(struct net_device *dev) | 9932 | static int ipw_ethtool_get_eeprom_len(struct net_device *dev) |
6538 | { | 9933 | { |
6539 | return CX2_EEPROM_IMAGE_SIZE; | 9934 | return IPW_EEPROM_IMAGE_SIZE; |
6540 | } | 9935 | } |
6541 | 9936 | ||
6542 | static int ipw_ethtool_get_eeprom(struct net_device *dev, | 9937 | static int ipw_ethtool_get_eeprom(struct net_device *dev, |
@@ -6544,10 +9939,11 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev, | |||
6544 | { | 9939 | { |
6545 | struct ipw_priv *p = ieee80211_priv(dev); | 9940 | struct ipw_priv *p = ieee80211_priv(dev); |
6546 | 9941 | ||
6547 | if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) | 9942 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) |
6548 | return -EINVAL; | 9943 | return -EINVAL; |
6549 | 9944 | down(&p->sem); | |
6550 | memcpy(bytes, &((u8 *) p->eeprom)[eeprom->offset], eeprom->len); | 9945 | memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); |
9946 | up(&p->sem); | ||
6551 | return 0; | 9947 | return 0; |
6552 | } | 9948 | } |
6553 | 9949 | ||
@@ -6557,23 +9953,23 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, | |||
6557 | struct ipw_priv *p = ieee80211_priv(dev); | 9953 | struct ipw_priv *p = ieee80211_priv(dev); |
6558 | int i; | 9954 | int i; |
6559 | 9955 | ||
6560 | if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) | 9956 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) |
6561 | return -EINVAL; | 9957 | return -EINVAL; |
6562 | 9958 | down(&p->sem); | |
6563 | memcpy(&((u8 *) p->eeprom)[eeprom->offset], bytes, eeprom->len); | 9959 | memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); |
6564 | for (i = IPW_EEPROM_DATA; | 9960 | for (i = IPW_EEPROM_DATA; |
6565 | i < IPW_EEPROM_DATA + CX2_EEPROM_IMAGE_SIZE; i++) | 9961 | i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++) |
6566 | ipw_write8(p, i, p->eeprom[i]); | 9962 | ipw_write8(p, i, p->eeprom[i]); |
6567 | 9963 | up(&p->sem); | |
6568 | return 0; | 9964 | return 0; |
6569 | } | 9965 | } |
6570 | 9966 | ||
6571 | static struct ethtool_ops ipw_ethtool_ops = { | 9967 | static struct ethtool_ops ipw_ethtool_ops = { |
6572 | .get_link = ipw_ethtool_get_link, | 9968 | .get_link = ipw_ethtool_get_link, |
6573 | .get_drvinfo = ipw_ethtool_get_drvinfo, | 9969 | .get_drvinfo = ipw_ethtool_get_drvinfo, |
6574 | .get_eeprom_len = ipw_ethtool_get_eeprom_len, | 9970 | .get_eeprom_len = ipw_ethtool_get_eeprom_len, |
6575 | .get_eeprom = ipw_ethtool_get_eeprom, | 9971 | .get_eeprom = ipw_ethtool_get_eeprom, |
6576 | .set_eeprom = ipw_ethtool_set_eeprom, | 9972 | .set_eeprom = ipw_ethtool_set_eeprom, |
6577 | }; | 9973 | }; |
6578 | 9974 | ||
6579 | static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | 9975 | static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) |
@@ -6591,8 +9987,8 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | |||
6591 | goto none; | 9987 | goto none; |
6592 | } | 9988 | } |
6593 | 9989 | ||
6594 | inta = ipw_read32(priv, CX2_INTA_RW); | 9990 | inta = ipw_read32(priv, IPW_INTA_RW); |
6595 | inta_mask = ipw_read32(priv, CX2_INTA_MASK_R); | 9991 | inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); |
6596 | 9992 | ||
6597 | if (inta == 0xFFFFFFFF) { | 9993 | if (inta == 0xFFFFFFFF) { |
6598 | /* Hardware disappeared */ | 9994 | /* Hardware disappeared */ |
@@ -6600,7 +9996,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | |||
6600 | goto none; | 9996 | goto none; |
6601 | } | 9997 | } |
6602 | 9998 | ||
6603 | if (!(inta & (CX2_INTA_MASK_ALL & inta_mask))) { | 9999 | if (!(inta & (IPW_INTA_MASK_ALL & inta_mask))) { |
6604 | /* Shared interrupt */ | 10000 | /* Shared interrupt */ |
6605 | goto none; | 10001 | goto none; |
6606 | } | 10002 | } |
@@ -6609,8 +10005,8 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | |||
6609 | ipw_disable_interrupts(priv); | 10005 | ipw_disable_interrupts(priv); |
6610 | 10006 | ||
6611 | /* ack current interrupts */ | 10007 | /* ack current interrupts */ |
6612 | inta &= (CX2_INTA_MASK_ALL & inta_mask); | 10008 | inta &= (IPW_INTA_MASK_ALL & inta_mask); |
6613 | ipw_write32(priv, CX2_INTA_RW, inta); | 10009 | ipw_write32(priv, IPW_INTA_RW, inta); |
6614 | 10010 | ||
6615 | /* Cache INTA value for our tasklet */ | 10011 | /* Cache INTA value for our tasklet */ |
6616 | priv->isr_inta = inta; | 10012 | priv->isr_inta = inta; |
@@ -6656,28 +10052,116 @@ static void ipw_rf_kill(void *adapter) | |||
6656 | spin_unlock_irqrestore(&priv->lock, flags); | 10052 | spin_unlock_irqrestore(&priv->lock, flags); |
6657 | } | 10053 | } |
6658 | 10054 | ||
10055 | static void ipw_bg_rf_kill(void *data) | ||
10056 | { | ||
10057 | struct ipw_priv *priv = data; | ||
10058 | down(&priv->sem); | ||
10059 | ipw_rf_kill(data); | ||
10060 | up(&priv->sem); | ||
10061 | } | ||
10062 | |||
10063 | void ipw_link_up(struct ipw_priv *priv) | ||
10064 | { | ||
10065 | priv->last_seq_num = -1; | ||
10066 | priv->last_frag_num = -1; | ||
10067 | priv->last_packet_time = 0; | ||
10068 | |||
10069 | netif_carrier_on(priv->net_dev); | ||
10070 | if (netif_queue_stopped(priv->net_dev)) { | ||
10071 | IPW_DEBUG_NOTIF("waking queue\n"); | ||
10072 | netif_wake_queue(priv->net_dev); | ||
10073 | } else { | ||
10074 | IPW_DEBUG_NOTIF("starting queue\n"); | ||
10075 | netif_start_queue(priv->net_dev); | ||
10076 | } | ||
10077 | |||
10078 | cancel_delayed_work(&priv->request_scan); | ||
10079 | ipw_reset_stats(priv); | ||
10080 | /* Ensure the rate is updated immediately */ | ||
10081 | priv->last_rate = ipw_get_current_rate(priv); | ||
10082 | ipw_gather_stats(priv); | ||
10083 | ipw_led_link_up(priv); | ||
10084 | notify_wx_assoc_event(priv); | ||
10085 | |||
10086 | if (priv->config & CFG_BACKGROUND_SCAN) | ||
10087 | queue_delayed_work(priv->workqueue, &priv->request_scan, HZ); | ||
10088 | } | ||
10089 | |||
10090 | static void ipw_bg_link_up(void *data) | ||
10091 | { | ||
10092 | struct ipw_priv *priv = data; | ||
10093 | down(&priv->sem); | ||
10094 | ipw_link_up(data); | ||
10095 | up(&priv->sem); | ||
10096 | } | ||
10097 | |||
10098 | void ipw_link_down(struct ipw_priv *priv) | ||
10099 | { | ||
10100 | ipw_led_link_down(priv); | ||
10101 | netif_carrier_off(priv->net_dev); | ||
10102 | netif_stop_queue(priv->net_dev); | ||
10103 | notify_wx_assoc_event(priv); | ||
10104 | |||
10105 | /* Cancel any queued work ... */ | ||
10106 | cancel_delayed_work(&priv->request_scan); | ||
10107 | cancel_delayed_work(&priv->adhoc_check); | ||
10108 | cancel_delayed_work(&priv->gather_stats); | ||
10109 | |||
10110 | ipw_reset_stats(priv); | ||
10111 | |||
10112 | if (!(priv->status & STATUS_EXIT_PENDING)) { | ||
10113 | /* Queue up another scan... */ | ||
10114 | queue_work(priv->workqueue, &priv->request_scan); | ||
10115 | } | ||
10116 | } | ||
10117 | |||
10118 | static void ipw_bg_link_down(void *data) | ||
10119 | { | ||
10120 | struct ipw_priv *priv = data; | ||
10121 | down(&priv->sem); | ||
10122 | ipw_link_down(data); | ||
10123 | up(&priv->sem); | ||
10124 | } | ||
10125 | |||
6659 | static int ipw_setup_deferred_work(struct ipw_priv *priv) | 10126 | static int ipw_setup_deferred_work(struct ipw_priv *priv) |
6660 | { | 10127 | { |
6661 | int ret = 0; | 10128 | int ret = 0; |
6662 | 10129 | ||
6663 | priv->workqueue = create_workqueue(DRV_NAME); | 10130 | priv->workqueue = create_workqueue(DRV_NAME); |
6664 | init_waitqueue_head(&priv->wait_command_queue); | 10131 | init_waitqueue_head(&priv->wait_command_queue); |
6665 | 10132 | init_waitqueue_head(&priv->wait_state); | |
6666 | INIT_WORK(&priv->adhoc_check, ipw_adhoc_check, priv); | 10133 | |
6667 | INIT_WORK(&priv->associate, ipw_associate, priv); | 10134 | INIT_WORK(&priv->adhoc_check, ipw_bg_adhoc_check, priv); |
6668 | INIT_WORK(&priv->disassociate, ipw_disassociate, priv); | 10135 | INIT_WORK(&priv->associate, ipw_bg_associate, priv); |
6669 | INIT_WORK(&priv->rx_replenish, ipw_rx_queue_replenish, priv); | 10136 | INIT_WORK(&priv->disassociate, ipw_bg_disassociate, priv); |
6670 | INIT_WORK(&priv->adapter_restart, ipw_adapter_restart, priv); | 10137 | INIT_WORK(&priv->system_config, ipw_system_config, priv); |
6671 | INIT_WORK(&priv->rf_kill, ipw_rf_kill, priv); | 10138 | INIT_WORK(&priv->rx_replenish, ipw_bg_rx_queue_replenish, priv); |
6672 | INIT_WORK(&priv->up, (void (*)(void *))ipw_up, priv); | 10139 | INIT_WORK(&priv->adapter_restart, ipw_bg_adapter_restart, priv); |
6673 | INIT_WORK(&priv->down, (void (*)(void *))ipw_down, priv); | 10140 | INIT_WORK(&priv->rf_kill, ipw_bg_rf_kill, priv); |
10141 | INIT_WORK(&priv->up, (void (*)(void *))ipw_bg_up, priv); | ||
10142 | INIT_WORK(&priv->down, (void (*)(void *))ipw_bg_down, priv); | ||
6674 | INIT_WORK(&priv->request_scan, | 10143 | INIT_WORK(&priv->request_scan, |
6675 | (void (*)(void *))ipw_request_scan, priv); | 10144 | (void (*)(void *))ipw_request_scan, priv); |
6676 | INIT_WORK(&priv->gather_stats, | 10145 | INIT_WORK(&priv->gather_stats, |
6677 | (void (*)(void *))ipw_gather_stats, priv); | 10146 | (void (*)(void *))ipw_bg_gather_stats, priv); |
6678 | INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_abort_scan, priv); | 10147 | INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_bg_abort_scan, priv); |
6679 | INIT_WORK(&priv->roam, ipw_roam, priv); | 10148 | INIT_WORK(&priv->roam, ipw_bg_roam, priv); |
6680 | INIT_WORK(&priv->scan_check, ipw_scan_check, priv); | 10149 | INIT_WORK(&priv->scan_check, ipw_bg_scan_check, priv); |
10150 | INIT_WORK(&priv->link_up, (void (*)(void *))ipw_bg_link_up, priv); | ||
10151 | INIT_WORK(&priv->link_down, (void (*)(void *))ipw_bg_link_down, priv); | ||
10152 | INIT_WORK(&priv->led_link_on, (void (*)(void *))ipw_bg_led_link_on, | ||
10153 | priv); | ||
10154 | INIT_WORK(&priv->led_link_off, (void (*)(void *))ipw_bg_led_link_off, | ||
10155 | priv); | ||
10156 | INIT_WORK(&priv->led_act_off, (void (*)(void *))ipw_bg_led_activity_off, | ||
10157 | priv); | ||
10158 | INIT_WORK(&priv->merge_networks, | ||
10159 | (void (*)(void *))ipw_merge_adhoc_network, priv); | ||
10160 | |||
10161 | #ifdef CONFIG_IPW_QOS | ||
10162 | INIT_WORK(&priv->qos_activate, (void (*)(void *))ipw_bg_qos_activate, | ||
10163 | priv); | ||
10164 | #endif /* CONFIG_IPW_QOS */ | ||
6681 | 10165 | ||
6682 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) | 10166 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) |
6683 | ipw_irq_tasklet, (unsigned long)priv); | 10167 | ipw_irq_tasklet, (unsigned long)priv); |
@@ -6690,34 +10174,36 @@ static void shim__set_security(struct net_device *dev, | |||
6690 | { | 10174 | { |
6691 | struct ipw_priv *priv = ieee80211_priv(dev); | 10175 | struct ipw_priv *priv = ieee80211_priv(dev); |
6692 | int i; | 10176 | int i; |
6693 | |||
6694 | for (i = 0; i < 4; i++) { | 10177 | for (i = 0; i < 4; i++) { |
6695 | if (sec->flags & (1 << i)) { | 10178 | if (sec->flags & (1 << i)) { |
6696 | priv->sec.key_sizes[i] = sec->key_sizes[i]; | 10179 | priv->ieee->sec.encode_alg[i] = sec->encode_alg[i]; |
10180 | priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; | ||
6697 | if (sec->key_sizes[i] == 0) | 10181 | if (sec->key_sizes[i] == 0) |
6698 | priv->sec.flags &= ~(1 << i); | 10182 | priv->ieee->sec.flags &= ~(1 << i); |
6699 | else | 10183 | else { |
6700 | memcpy(priv->sec.keys[i], sec->keys[i], | 10184 | memcpy(priv->ieee->sec.keys[i], sec->keys[i], |
6701 | sec->key_sizes[i]); | 10185 | sec->key_sizes[i]); |
6702 | priv->sec.flags |= (1 << i); | 10186 | priv->ieee->sec.flags |= (1 << i); |
10187 | } | ||
6703 | priv->status |= STATUS_SECURITY_UPDATED; | 10188 | priv->status |= STATUS_SECURITY_UPDATED; |
6704 | } | 10189 | } else if (sec->level != SEC_LEVEL_1) |
10190 | priv->ieee->sec.flags &= ~(1 << i); | ||
6705 | } | 10191 | } |
6706 | 10192 | ||
6707 | if ((sec->flags & SEC_ACTIVE_KEY) && | 10193 | if (sec->flags & SEC_ACTIVE_KEY) { |
6708 | priv->sec.active_key != sec->active_key) { | ||
6709 | if (sec->active_key <= 3) { | 10194 | if (sec->active_key <= 3) { |
6710 | priv->sec.active_key = sec->active_key; | 10195 | priv->ieee->sec.active_key = sec->active_key; |
6711 | priv->sec.flags |= SEC_ACTIVE_KEY; | 10196 | priv->ieee->sec.flags |= SEC_ACTIVE_KEY; |
6712 | } else | 10197 | } else |
6713 | priv->sec.flags &= ~SEC_ACTIVE_KEY; | 10198 | priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; |
6714 | priv->status |= STATUS_SECURITY_UPDATED; | 10199 | priv->status |= STATUS_SECURITY_UPDATED; |
6715 | } | 10200 | } else |
10201 | priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; | ||
6716 | 10202 | ||
6717 | if ((sec->flags & SEC_AUTH_MODE) && | 10203 | if ((sec->flags & SEC_AUTH_MODE) && |
6718 | (priv->sec.auth_mode != sec->auth_mode)) { | 10204 | (priv->ieee->sec.auth_mode != sec->auth_mode)) { |
6719 | priv->sec.auth_mode = sec->auth_mode; | 10205 | priv->ieee->sec.auth_mode = sec->auth_mode; |
6720 | priv->sec.flags |= SEC_AUTH_MODE; | 10206 | priv->ieee->sec.flags |= SEC_AUTH_MODE; |
6721 | if (sec->auth_mode == WLAN_AUTH_SHARED_KEY) | 10207 | if (sec->auth_mode == WLAN_AUTH_SHARED_KEY) |
6722 | priv->capability |= CAP_SHARED_KEY; | 10208 | priv->capability |= CAP_SHARED_KEY; |
6723 | else | 10209 | else |
@@ -6725,9 +10211,9 @@ static void shim__set_security(struct net_device *dev, | |||
6725 | priv->status |= STATUS_SECURITY_UPDATED; | 10211 | priv->status |= STATUS_SECURITY_UPDATED; |
6726 | } | 10212 | } |
6727 | 10213 | ||
6728 | if (sec->flags & SEC_ENABLED && priv->sec.enabled != sec->enabled) { | 10214 | if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { |
6729 | priv->sec.flags |= SEC_ENABLED; | 10215 | priv->ieee->sec.flags |= SEC_ENABLED; |
6730 | priv->sec.enabled = sec->enabled; | 10216 | priv->ieee->sec.enabled = sec->enabled; |
6731 | priv->status |= STATUS_SECURITY_UPDATED; | 10217 | priv->status |= STATUS_SECURITY_UPDATED; |
6732 | if (sec->enabled) | 10218 | if (sec->enabled) |
6733 | priv->capability |= CAP_PRIVACY_ON; | 10219 | priv->capability |= CAP_PRIVACY_ON; |
@@ -6735,12 +10221,18 @@ static void shim__set_security(struct net_device *dev, | |||
6735 | priv->capability &= ~CAP_PRIVACY_ON; | 10221 | priv->capability &= ~CAP_PRIVACY_ON; |
6736 | } | 10222 | } |
6737 | 10223 | ||
6738 | if (sec->flags & SEC_LEVEL && priv->sec.level != sec->level) { | 10224 | if (sec->flags & SEC_ENCRYPT) |
6739 | priv->sec.level = sec->level; | 10225 | priv->ieee->sec.encrypt = sec->encrypt; |
6740 | priv->sec.flags |= SEC_LEVEL; | 10226 | |
10227 | if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { | ||
10228 | priv->ieee->sec.level = sec->level; | ||
10229 | priv->ieee->sec.flags |= SEC_LEVEL; | ||
6741 | priv->status |= STATUS_SECURITY_UPDATED; | 10230 | priv->status |= STATUS_SECURITY_UPDATED; |
6742 | } | 10231 | } |
6743 | 10232 | ||
10233 | if (!priv->ieee->host_encrypt && (sec->flags & SEC_ENCRYPT)) | ||
10234 | ipw_set_hwcrypto_keys(priv); | ||
10235 | |||
6744 | /* To match current functionality of ipw2100 (which works well w/ | 10236 | /* To match current functionality of ipw2100 (which works well w/ |
6745 | * various supplicants, we don't force a disassociate if the | 10237 | * various supplicants, we don't force a disassociate if the |
6746 | * privacy capability changes ... */ | 10238 | * privacy capability changes ... */ |
@@ -6789,29 +10281,10 @@ static int init_supported_rates(struct ipw_priv *priv, | |||
6789 | 10281 | ||
6790 | static int ipw_config(struct ipw_priv *priv) | 10282 | static int ipw_config(struct ipw_priv *priv) |
6791 | { | 10283 | { |
6792 | int i; | ||
6793 | struct ipw_tx_power tx_power; | ||
6794 | |||
6795 | memset(&priv->sys_config, 0, sizeof(priv->sys_config)); | ||
6796 | memset(&tx_power, 0, sizeof(tx_power)); | ||
6797 | |||
6798 | /* This is only called from ipw_up, which resets/reloads the firmware | 10284 | /* This is only called from ipw_up, which resets/reloads the firmware |
6799 | so, we don't need to first disable the card before we configure | 10285 | so, we don't need to first disable the card before we configure |
6800 | it */ | 10286 | it */ |
6801 | 10287 | if (ipw_set_tx_power(priv)) | |
6802 | /* configure device for 'G' band */ | ||
6803 | tx_power.ieee_mode = IPW_G_MODE; | ||
6804 | tx_power.num_channels = 11; | ||
6805 | for (i = 0; i < 11; i++) { | ||
6806 | tx_power.channels_tx_power[i].channel_number = i + 1; | ||
6807 | tx_power.channels_tx_power[i].tx_power = priv->tx_power; | ||
6808 | } | ||
6809 | if (ipw_send_tx_power(priv, &tx_power)) | ||
6810 | goto error; | ||
6811 | |||
6812 | /* configure device to also handle 'B' band */ | ||
6813 | tx_power.ieee_mode = IPW_B_MODE; | ||
6814 | if (ipw_send_tx_power(priv, &tx_power)) | ||
6815 | goto error; | 10288 | goto error; |
6816 | 10289 | ||
6817 | /* initialize adapter address */ | 10290 | /* initialize adapter address */ |
@@ -6820,6 +10293,11 @@ static int ipw_config(struct ipw_priv *priv) | |||
6820 | 10293 | ||
6821 | /* set basic system config settings */ | 10294 | /* set basic system config settings */ |
6822 | init_sys_config(&priv->sys_config); | 10295 | init_sys_config(&priv->sys_config); |
10296 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | ||
10297 | priv->sys_config.answer_broadcast_ssid_probe = 1; | ||
10298 | else | ||
10299 | priv->sys_config.answer_broadcast_ssid_probe = 0; | ||
10300 | |||
6823 | if (ipw_send_system_config(priv, &priv->sys_config)) | 10301 | if (ipw_send_system_config(priv, &priv->sys_config)) |
6824 | goto error; | 10302 | goto error; |
6825 | 10303 | ||
@@ -6832,6 +10310,10 @@ static int ipw_config(struct ipw_priv *priv) | |||
6832 | if (ipw_send_rts_threshold(priv, priv->rts_threshold)) | 10310 | if (ipw_send_rts_threshold(priv, priv->rts_threshold)) |
6833 | goto error; | 10311 | goto error; |
6834 | } | 10312 | } |
10313 | #ifdef CONFIG_IPW_QOS | ||
10314 | IPW_DEBUG_QOS("QoS: call ipw_qos_activate\n"); | ||
10315 | ipw_qos_activate(priv, NULL); | ||
10316 | #endif /* CONFIG_IPW_QOS */ | ||
6835 | 10317 | ||
6836 | if (ipw_set_random_seed(priv)) | 10318 | if (ipw_set_random_seed(priv)) |
6837 | goto error; | 10319 | goto error; |
@@ -6840,9 +10322,17 @@ static int ipw_config(struct ipw_priv *priv) | |||
6840 | if (ipw_send_host_complete(priv)) | 10322 | if (ipw_send_host_complete(priv)) |
6841 | goto error; | 10323 | goto error; |
6842 | 10324 | ||
6843 | /* If configured to try and auto-associate, kick off a scan */ | 10325 | priv->status |= STATUS_INIT; |
6844 | if ((priv->config & CFG_ASSOCIATE) && ipw_request_scan(priv)) | 10326 | |
6845 | goto error; | 10327 | ipw_led_init(priv); |
10328 | ipw_led_radio_on(priv); | ||
10329 | priv->notif_missed_beacons = 0; | ||
10330 | |||
10331 | /* Set hardware WEP key if it is configured. */ | ||
10332 | if ((priv->capability & CAP_PRIVACY_ON) && | ||
10333 | (priv->ieee->sec.level == SEC_LEVEL_1) && | ||
10334 | !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) | ||
10335 | ipw_set_hwcrypto_keys(priv); | ||
6846 | 10336 | ||
6847 | return 0; | 10337 | return 0; |
6848 | 10338 | ||
@@ -6850,20 +10340,379 @@ static int ipw_config(struct ipw_priv *priv) | |||
6850 | return -EIO; | 10340 | return -EIO; |
6851 | } | 10341 | } |
6852 | 10342 | ||
10343 | /* | ||
10344 | * NOTE: | ||
10345 | * | ||
10346 | * These tables have been tested in conjunction with the | ||
10347 | * Intel PRO/Wireless 2200BG and 2915ABG Network Connection Adapters. | ||
10348 | * | ||
10349 | * Altering this values, using it on other hardware, or in geographies | ||
10350 | * not intended for resale of the above mentioned Intel adapters has | ||
10351 | * not been tested. | ||
10352 | * | ||
10353 | */ | ||
10354 | static const struct ieee80211_geo ipw_geos[] = { | ||
10355 | { /* Restricted */ | ||
10356 | "---", | ||
10357 | .bg_channels = 11, | ||
10358 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10359 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10360 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10361 | {2457, 10}, {2462, 11}}, | ||
10362 | }, | ||
10363 | |||
10364 | { /* Custom US/Canada */ | ||
10365 | "ZZF", | ||
10366 | .bg_channels = 11, | ||
10367 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10368 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10369 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10370 | {2457, 10}, {2462, 11}}, | ||
10371 | .a_channels = 8, | ||
10372 | .a = {{5180, 36}, | ||
10373 | {5200, 40}, | ||
10374 | {5220, 44}, | ||
10375 | {5240, 48}, | ||
10376 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10377 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10378 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10379 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10380 | }, | ||
10381 | |||
10382 | { /* Rest of World */ | ||
10383 | "ZZD", | ||
10384 | .bg_channels = 13, | ||
10385 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10386 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10387 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10388 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
10389 | {2472, 13}}, | ||
10390 | }, | ||
10391 | |||
10392 | { /* Custom USA & Europe & High */ | ||
10393 | "ZZA", | ||
10394 | .bg_channels = 11, | ||
10395 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10396 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10397 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10398 | {2457, 10}, {2462, 11}}, | ||
10399 | .a_channels = 13, | ||
10400 | .a = {{5180, 36}, | ||
10401 | {5200, 40}, | ||
10402 | {5220, 44}, | ||
10403 | {5240, 48}, | ||
10404 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10405 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10406 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10407 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10408 | {5745, 149}, | ||
10409 | {5765, 153}, | ||
10410 | {5785, 157}, | ||
10411 | {5805, 161}, | ||
10412 | {5825, 165}}, | ||
10413 | }, | ||
10414 | |||
10415 | { /* Custom NA & Europe */ | ||
10416 | "ZZB", | ||
10417 | .bg_channels = 11, | ||
10418 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10419 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10420 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10421 | {2457, 10}, {2462, 11}}, | ||
10422 | .a_channels = 13, | ||
10423 | .a = {{5180, 36}, | ||
10424 | {5200, 40}, | ||
10425 | {5220, 44}, | ||
10426 | {5240, 48}, | ||
10427 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10428 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10429 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10430 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10431 | {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, | ||
10432 | {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, | ||
10433 | {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, | ||
10434 | {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, | ||
10435 | {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10436 | }, | ||
10437 | |||
10438 | { /* Custom Japan */ | ||
10439 | "ZZC", | ||
10440 | .bg_channels = 11, | ||
10441 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10442 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10443 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10444 | {2457, 10}, {2462, 11}}, | ||
10445 | .a_channels = 4, | ||
10446 | .a = {{5170, 34}, {5190, 38}, | ||
10447 | {5210, 42}, {5230, 46}}, | ||
10448 | }, | ||
10449 | |||
10450 | { /* Custom */ | ||
10451 | "ZZM", | ||
10452 | .bg_channels = 11, | ||
10453 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10454 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10455 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10456 | {2457, 10}, {2462, 11}}, | ||
10457 | }, | ||
10458 | |||
10459 | { /* Europe */ | ||
10460 | "ZZE", | ||
10461 | .bg_channels = 13, | ||
10462 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10463 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10464 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10465 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
10466 | {2472, 13}}, | ||
10467 | .a_channels = 19, | ||
10468 | .a = {{5180, 36}, | ||
10469 | {5200, 40}, | ||
10470 | {5220, 44}, | ||
10471 | {5240, 48}, | ||
10472 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10473 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10474 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10475 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10476 | {5500, 100, IEEE80211_CH_PASSIVE_ONLY}, | ||
10477 | {5520, 104, IEEE80211_CH_PASSIVE_ONLY}, | ||
10478 | {5540, 108, IEEE80211_CH_PASSIVE_ONLY}, | ||
10479 | {5560, 112, IEEE80211_CH_PASSIVE_ONLY}, | ||
10480 | {5580, 116, IEEE80211_CH_PASSIVE_ONLY}, | ||
10481 | {5600, 120, IEEE80211_CH_PASSIVE_ONLY}, | ||
10482 | {5620, 124, IEEE80211_CH_PASSIVE_ONLY}, | ||
10483 | {5640, 128, IEEE80211_CH_PASSIVE_ONLY}, | ||
10484 | {5660, 132, IEEE80211_CH_PASSIVE_ONLY}, | ||
10485 | {5680, 136, IEEE80211_CH_PASSIVE_ONLY}, | ||
10486 | {5700, 140, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10487 | }, | ||
10488 | |||
10489 | { /* Custom Japan */ | ||
10490 | "ZZJ", | ||
10491 | .bg_channels = 14, | ||
10492 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10493 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10494 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10495 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
10496 | {2472, 13}, {2484, 14, IEEE80211_CH_B_ONLY}}, | ||
10497 | .a_channels = 4, | ||
10498 | .a = {{5170, 34}, {5190, 38}, | ||
10499 | {5210, 42}, {5230, 46}}, | ||
10500 | }, | ||
10501 | |||
10502 | { /* Rest of World */ | ||
10503 | "ZZR", | ||
10504 | .bg_channels = 14, | ||
10505 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10506 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10507 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10508 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
10509 | {2472, 13}, {2484, 14, IEEE80211_CH_B_ONLY | | ||
10510 | IEEE80211_CH_PASSIVE_ONLY}}, | ||
10511 | }, | ||
10512 | |||
10513 | { /* High Band */ | ||
10514 | "ZZH", | ||
10515 | .bg_channels = 13, | ||
10516 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10517 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10518 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10519 | {2457, 10}, {2462, 11}, | ||
10520 | {2467, 12, IEEE80211_CH_PASSIVE_ONLY}, | ||
10521 | {2472, 13, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10522 | .a_channels = 4, | ||
10523 | .a = {{5745, 149}, {5765, 153}, | ||
10524 | {5785, 157}, {5805, 161}}, | ||
10525 | }, | ||
10526 | |||
10527 | { /* Custom Europe */ | ||
10528 | "ZZG", | ||
10529 | .bg_channels = 13, | ||
10530 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10531 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10532 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10533 | {2457, 10}, {2462, 11}, | ||
10534 | {2467, 12}, {2472, 13}}, | ||
10535 | .a_channels = 4, | ||
10536 | .a = {{5180, 36}, {5200, 40}, | ||
10537 | {5220, 44}, {5240, 48}}, | ||
10538 | }, | ||
10539 | |||
10540 | { /* Europe */ | ||
10541 | "ZZK", | ||
10542 | .bg_channels = 13, | ||
10543 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10544 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10545 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10546 | {2457, 10}, {2462, 11}, | ||
10547 | {2467, 12, IEEE80211_CH_PASSIVE_ONLY}, | ||
10548 | {2472, 13, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10549 | .a_channels = 24, | ||
10550 | .a = {{5180, 36, IEEE80211_CH_PASSIVE_ONLY}, | ||
10551 | {5200, 40, IEEE80211_CH_PASSIVE_ONLY}, | ||
10552 | {5220, 44, IEEE80211_CH_PASSIVE_ONLY}, | ||
10553 | {5240, 48, IEEE80211_CH_PASSIVE_ONLY}, | ||
10554 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10555 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10556 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10557 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10558 | {5500, 100, IEEE80211_CH_PASSIVE_ONLY}, | ||
10559 | {5520, 104, IEEE80211_CH_PASSIVE_ONLY}, | ||
10560 | {5540, 108, IEEE80211_CH_PASSIVE_ONLY}, | ||
10561 | {5560, 112, IEEE80211_CH_PASSIVE_ONLY}, | ||
10562 | {5580, 116, IEEE80211_CH_PASSIVE_ONLY}, | ||
10563 | {5600, 120, IEEE80211_CH_PASSIVE_ONLY}, | ||
10564 | {5620, 124, IEEE80211_CH_PASSIVE_ONLY}, | ||
10565 | {5640, 128, IEEE80211_CH_PASSIVE_ONLY}, | ||
10566 | {5660, 132, IEEE80211_CH_PASSIVE_ONLY}, | ||
10567 | {5680, 136, IEEE80211_CH_PASSIVE_ONLY}, | ||
10568 | {5700, 140, IEEE80211_CH_PASSIVE_ONLY}, | ||
10569 | {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, | ||
10570 | {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, | ||
10571 | {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, | ||
10572 | {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, | ||
10573 | {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10574 | }, | ||
10575 | |||
10576 | { /* Europe */ | ||
10577 | "ZZL", | ||
10578 | .bg_channels = 11, | ||
10579 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10580 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10581 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10582 | {2457, 10}, {2462, 11}}, | ||
10583 | .a_channels = 13, | ||
10584 | .a = {{5180, 36, IEEE80211_CH_PASSIVE_ONLY}, | ||
10585 | {5200, 40, IEEE80211_CH_PASSIVE_ONLY}, | ||
10586 | {5220, 44, IEEE80211_CH_PASSIVE_ONLY}, | ||
10587 | {5240, 48, IEEE80211_CH_PASSIVE_ONLY}, | ||
10588 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10589 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10590 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10591 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10592 | {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, | ||
10593 | {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, | ||
10594 | {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, | ||
10595 | {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, | ||
10596 | {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10597 | } | ||
10598 | }; | ||
10599 | |||
10600 | /* GEO code borrowed from ieee80211_geo.c */ | ||
10601 | static int ipw_is_valid_channel(struct ieee80211_device *ieee, u8 channel) | ||
10602 | { | ||
10603 | int i; | ||
10604 | |||
10605 | /* Driver needs to initialize the geography map before using | ||
10606 | * these helper functions */ | ||
10607 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
10608 | |||
10609 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
10610 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
10611 | /* NOTE: If G mode is currently supported but | ||
10612 | * this is a B only channel, we don't see it | ||
10613 | * as valid. */ | ||
10614 | if ((ieee->geo.bg[i].channel == channel) && | ||
10615 | (!(ieee->mode & IEEE_G) || | ||
10616 | !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) | ||
10617 | return IEEE80211_24GHZ_BAND; | ||
10618 | |||
10619 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
10620 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
10621 | if (ieee->geo.a[i].channel == channel) | ||
10622 | return IEEE80211_52GHZ_BAND; | ||
10623 | |||
10624 | return 0; | ||
10625 | } | ||
10626 | |||
10627 | static int ipw_channel_to_index(struct ieee80211_device *ieee, u8 channel) | ||
10628 | { | ||
10629 | int i; | ||
10630 | |||
10631 | /* Driver needs to initialize the geography map before using | ||
10632 | * these helper functions */ | ||
10633 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
10634 | |||
10635 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
10636 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
10637 | if (ieee->geo.bg[i].channel == channel) | ||
10638 | return i; | ||
10639 | |||
10640 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
10641 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
10642 | if (ieee->geo.a[i].channel == channel) | ||
10643 | return i; | ||
10644 | |||
10645 | return -1; | ||
10646 | } | ||
10647 | |||
10648 | static u8 ipw_freq_to_channel(struct ieee80211_device *ieee, u32 freq) | ||
10649 | { | ||
10650 | int i; | ||
10651 | |||
10652 | /* Driver needs to initialize the geography map before using | ||
10653 | * these helper functions */ | ||
10654 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
10655 | |||
10656 | freq /= 100000; | ||
10657 | |||
10658 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
10659 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
10660 | if (ieee->geo.bg[i].freq == freq) | ||
10661 | return ieee->geo.bg[i].channel; | ||
10662 | |||
10663 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
10664 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
10665 | if (ieee->geo.a[i].freq == freq) | ||
10666 | return ieee->geo.a[i].channel; | ||
10667 | |||
10668 | return 0; | ||
10669 | } | ||
10670 | |||
10671 | static int ipw_set_geo(struct ieee80211_device *ieee, | ||
10672 | const struct ieee80211_geo *geo) | ||
10673 | { | ||
10674 | memcpy(ieee->geo.name, geo->name, 3); | ||
10675 | ieee->geo.name[3] = '\0'; | ||
10676 | ieee->geo.bg_channels = geo->bg_channels; | ||
10677 | ieee->geo.a_channels = geo->a_channels; | ||
10678 | memcpy(ieee->geo.bg, geo->bg, geo->bg_channels * | ||
10679 | sizeof(struct ieee80211_channel)); | ||
10680 | memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels * | ||
10681 | sizeof(struct ieee80211_channel)); | ||
10682 | return 0; | ||
10683 | } | ||
10684 | |||
10685 | static const struct ieee80211_geo *ipw_get_geo(struct ieee80211_device *ieee) | ||
10686 | { | ||
10687 | return &ieee->geo; | ||
10688 | } | ||
10689 | |||
6853 | #define MAX_HW_RESTARTS 5 | 10690 | #define MAX_HW_RESTARTS 5 |
6854 | static int ipw_up(struct ipw_priv *priv) | 10691 | static int ipw_up(struct ipw_priv *priv) |
6855 | { | 10692 | { |
6856 | int rc, i; | 10693 | int rc, i, j; |
6857 | 10694 | ||
6858 | if (priv->status & STATUS_EXIT_PENDING) | 10695 | if (priv->status & STATUS_EXIT_PENDING) |
6859 | return -EIO; | 10696 | return -EIO; |
6860 | 10697 | ||
10698 | if (cmdlog && !priv->cmdlog) { | ||
10699 | priv->cmdlog = kmalloc(sizeof(*priv->cmdlog) * cmdlog, | ||
10700 | GFP_KERNEL); | ||
10701 | if (priv->cmdlog == NULL) { | ||
10702 | IPW_ERROR("Error allocating %d command log entries.\n", | ||
10703 | cmdlog); | ||
10704 | } else { | ||
10705 | memset(priv->cmdlog, 0, sizeof(*priv->cmdlog) * cmdlog); | ||
10706 | priv->cmdlog_len = cmdlog; | ||
10707 | } | ||
10708 | } | ||
10709 | |||
6861 | for (i = 0; i < MAX_HW_RESTARTS; i++) { | 10710 | for (i = 0; i < MAX_HW_RESTARTS; i++) { |
6862 | /* Load the microcode, firmware, and eeprom. | 10711 | /* Load the microcode, firmware, and eeprom. |
6863 | * Also start the clocks. */ | 10712 | * Also start the clocks. */ |
6864 | rc = ipw_load(priv); | 10713 | rc = ipw_load(priv); |
6865 | if (rc) { | 10714 | if (rc) { |
6866 | IPW_ERROR("Unable to load firmware: 0x%08X\n", rc); | 10715 | IPW_ERROR("Unable to load firmware: %d\n", rc); |
6867 | return rc; | 10716 | return rc; |
6868 | } | 10717 | } |
6869 | 10718 | ||
@@ -6872,20 +10721,50 @@ static int ipw_up(struct ipw_priv *priv) | |||
6872 | eeprom_parse_mac(priv, priv->mac_addr); | 10721 | eeprom_parse_mac(priv, priv->mac_addr); |
6873 | memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); | 10722 | memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); |
6874 | 10723 | ||
6875 | if (priv->status & STATUS_RF_KILL_MASK) | 10724 | for (j = 0; j < ARRAY_SIZE(ipw_geos); j++) { |
10725 | if (!memcmp(&priv->eeprom[EEPROM_COUNTRY_CODE], | ||
10726 | ipw_geos[j].name, 3)) | ||
10727 | break; | ||
10728 | } | ||
10729 | if (j == ARRAY_SIZE(ipw_geos)) { | ||
10730 | IPW_WARNING("SKU [%c%c%c] not recognized.\n", | ||
10731 | priv->eeprom[EEPROM_COUNTRY_CODE + 0], | ||
10732 | priv->eeprom[EEPROM_COUNTRY_CODE + 1], | ||
10733 | priv->eeprom[EEPROM_COUNTRY_CODE + 2]); | ||
10734 | j = 0; | ||
10735 | } | ||
10736 | if (ipw_set_geo(priv->ieee, &ipw_geos[j])) { | ||
10737 | IPW_WARNING("Could not set geography."); | ||
10738 | return 0; | ||
10739 | } | ||
10740 | |||
10741 | IPW_DEBUG_INFO("Geography %03d [%s] detected.\n", | ||
10742 | j, priv->ieee->geo.name); | ||
10743 | |||
10744 | if (priv->status & STATUS_RF_KILL_SW) { | ||
10745 | IPW_WARNING("Radio disabled by module parameter.\n"); | ||
10746 | return 0; | ||
10747 | } else if (rf_kill_active(priv)) { | ||
10748 | IPW_WARNING("Radio Frequency Kill Switch is On:\n" | ||
10749 | "Kill switch must be turned off for " | ||
10750 | "wireless networking to work.\n"); | ||
10751 | queue_delayed_work(priv->workqueue, &priv->rf_kill, | ||
10752 | 2 * HZ); | ||
6876 | return 0; | 10753 | return 0; |
10754 | } | ||
6877 | 10755 | ||
6878 | rc = ipw_config(priv); | 10756 | rc = ipw_config(priv); |
6879 | if (!rc) { | 10757 | if (!rc) { |
6880 | IPW_DEBUG_INFO("Configured device on count %i\n", i); | 10758 | IPW_DEBUG_INFO("Configured device on count %i\n", i); |
6881 | priv->notif_missed_beacons = 0; | 10759 | |
6882 | netif_start_queue(priv->net_dev); | 10760 | /* If configure to try and auto-associate, kick |
10761 | * off a scan. */ | ||
10762 | queue_work(priv->workqueue, &priv->request_scan); | ||
10763 | |||
6883 | return 0; | 10764 | return 0; |
6884 | } else { | ||
6885 | IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", | ||
6886 | rc); | ||
6887 | } | 10765 | } |
6888 | 10766 | ||
10767 | IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", rc); | ||
6889 | IPW_DEBUG_INFO("Failed to config device on retry %d of %d\n", | 10768 | IPW_DEBUG_INFO("Failed to config device on retry %d of %d\n", |
6890 | i, MAX_HW_RESTARTS); | 10769 | i, MAX_HW_RESTARTS); |
6891 | 10770 | ||
@@ -6897,47 +10776,101 @@ static int ipw_up(struct ipw_priv *priv) | |||
6897 | /* tried to restart and config the device for as long as our | 10776 | /* tried to restart and config the device for as long as our |
6898 | * patience could withstand */ | 10777 | * patience could withstand */ |
6899 | IPW_ERROR("Unable to initialize device after %d attempts.\n", i); | 10778 | IPW_ERROR("Unable to initialize device after %d attempts.\n", i); |
10779 | |||
6900 | return -EIO; | 10780 | return -EIO; |
6901 | } | 10781 | } |
6902 | 10782 | ||
6903 | static void ipw_down(struct ipw_priv *priv) | 10783 | static void ipw_bg_up(void *data) |
10784 | { | ||
10785 | struct ipw_priv *priv = data; | ||
10786 | down(&priv->sem); | ||
10787 | ipw_up(data); | ||
10788 | up(&priv->sem); | ||
10789 | } | ||
10790 | |||
10791 | static void ipw_deinit(struct ipw_priv *priv) | ||
6904 | { | 10792 | { |
10793 | int i; | ||
10794 | |||
10795 | if (priv->status & STATUS_SCANNING) { | ||
10796 | IPW_DEBUG_INFO("Aborting scan during shutdown.\n"); | ||
10797 | ipw_abort_scan(priv); | ||
10798 | } | ||
10799 | |||
10800 | if (priv->status & STATUS_ASSOCIATED) { | ||
10801 | IPW_DEBUG_INFO("Disassociating during shutdown.\n"); | ||
10802 | ipw_disassociate(priv); | ||
10803 | } | ||
10804 | |||
10805 | ipw_led_shutdown(priv); | ||
10806 | |||
10807 | /* Wait up to 1s for status to change to not scanning and not | ||
10808 | * associated (disassociation can take a while for a ful 802.11 | ||
10809 | * exchange */ | ||
10810 | for (i = 1000; i && (priv->status & | ||
10811 | (STATUS_DISASSOCIATING | | ||
10812 | STATUS_ASSOCIATED | STATUS_SCANNING)); i--) | ||
10813 | udelay(10); | ||
10814 | |||
10815 | if (priv->status & (STATUS_DISASSOCIATING | | ||
10816 | STATUS_ASSOCIATED | STATUS_SCANNING)) | ||
10817 | IPW_DEBUG_INFO("Still associated or scanning...\n"); | ||
10818 | else | ||
10819 | IPW_DEBUG_INFO("Took %dms to de-init\n", 1000 - i); | ||
10820 | |||
6905 | /* Attempt to disable the card */ | 10821 | /* Attempt to disable the card */ |
6906 | #if 0 | ||
6907 | ipw_send_card_disable(priv, 0); | 10822 | ipw_send_card_disable(priv, 0); |
6908 | #endif | 10823 | |
10824 | priv->status &= ~STATUS_INIT; | ||
10825 | } | ||
10826 | |||
10827 | static void ipw_down(struct ipw_priv *priv) | ||
10828 | { | ||
10829 | int exit_pending = priv->status & STATUS_EXIT_PENDING; | ||
10830 | |||
10831 | priv->status |= STATUS_EXIT_PENDING; | ||
10832 | |||
10833 | if (ipw_is_init(priv)) | ||
10834 | ipw_deinit(priv); | ||
10835 | |||
10836 | /* Wipe out the EXIT_PENDING status bit if we are not actually | ||
10837 | * exiting the module */ | ||
10838 | if (!exit_pending) | ||
10839 | priv->status &= ~STATUS_EXIT_PENDING; | ||
6909 | 10840 | ||
6910 | /* tell the device to stop sending interrupts */ | 10841 | /* tell the device to stop sending interrupts */ |
6911 | ipw_disable_interrupts(priv); | 10842 | ipw_disable_interrupts(priv); |
6912 | 10843 | ||
6913 | /* Clear all bits but the RF Kill */ | 10844 | /* Clear all bits but the RF Kill */ |
6914 | priv->status &= STATUS_RF_KILL_MASK; | 10845 | priv->status &= STATUS_RF_KILL_MASK | STATUS_EXIT_PENDING; |
6915 | |||
6916 | netif_carrier_off(priv->net_dev); | 10846 | netif_carrier_off(priv->net_dev); |
6917 | netif_stop_queue(priv->net_dev); | 10847 | netif_stop_queue(priv->net_dev); |
6918 | 10848 | ||
6919 | ipw_stop_nic(priv); | 10849 | ipw_stop_nic(priv); |
10850 | |||
10851 | ipw_led_radio_off(priv); | ||
10852 | } | ||
10853 | |||
10854 | static void ipw_bg_down(void *data) | ||
10855 | { | ||
10856 | struct ipw_priv *priv = data; | ||
10857 | down(&priv->sem); | ||
10858 | ipw_down(data); | ||
10859 | up(&priv->sem); | ||
6920 | } | 10860 | } |
6921 | 10861 | ||
6922 | /* Called by register_netdev() */ | 10862 | /* Called by register_netdev() */ |
6923 | static int ipw_net_init(struct net_device *dev) | 10863 | static int ipw_net_init(struct net_device *dev) |
6924 | { | 10864 | { |
6925 | struct ipw_priv *priv = ieee80211_priv(dev); | 10865 | struct ipw_priv *priv = ieee80211_priv(dev); |
10866 | down(&priv->sem); | ||
6926 | 10867 | ||
6927 | if (priv->status & STATUS_RF_KILL_SW) { | 10868 | if (ipw_up(priv)) { |
6928 | IPW_WARNING("Radio disabled by module parameter.\n"); | 10869 | up(&priv->sem); |
6929 | return 0; | ||
6930 | } else if (rf_kill_active(priv)) { | ||
6931 | IPW_WARNING("Radio Frequency Kill Switch is On:\n" | ||
6932 | "Kill switch must be turned off for " | ||
6933 | "wireless networking to work.\n"); | ||
6934 | queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); | ||
6935 | return 0; | ||
6936 | } | ||
6937 | |||
6938 | if (ipw_up(priv)) | ||
6939 | return -EIO; | 10870 | return -EIO; |
10871 | } | ||
6940 | 10872 | ||
10873 | up(&priv->sem); | ||
6941 | return 0; | 10874 | return 0; |
6942 | } | 10875 | } |
6943 | 10876 | ||
@@ -6962,7 +10895,7 @@ static struct pci_device_id card_ids[] = { | |||
6962 | {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2762, 0, 0, 0}, | 10895 | {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2762, 0, 0, 0}, |
6963 | {PCI_VENDOR_ID_INTEL, 0x104f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 10896 | {PCI_VENDOR_ID_INTEL, 0x104f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
6964 | {PCI_VENDOR_ID_INTEL, 0x4220, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ | 10897 | {PCI_VENDOR_ID_INTEL, 0x4220, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ |
6965 | {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* 2225BG */ | 10898 | {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ |
6966 | {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ | 10899 | {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ |
6967 | {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ | 10900 | {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ |
6968 | 10901 | ||
@@ -6982,11 +10915,16 @@ static struct attribute *ipw_sysfs_entries[] = { | |||
6982 | &dev_attr_nic_type.attr, | 10915 | &dev_attr_nic_type.attr, |
6983 | &dev_attr_status.attr, | 10916 | &dev_attr_status.attr, |
6984 | &dev_attr_cfg.attr, | 10917 | &dev_attr_cfg.attr, |
6985 | &dev_attr_dump_errors.attr, | 10918 | &dev_attr_error.attr, |
6986 | &dev_attr_dump_events.attr, | 10919 | &dev_attr_event_log.attr, |
10920 | &dev_attr_cmd_log.attr, | ||
6987 | &dev_attr_eeprom_delay.attr, | 10921 | &dev_attr_eeprom_delay.attr, |
6988 | &dev_attr_ucode_version.attr, | 10922 | &dev_attr_ucode_version.attr, |
6989 | &dev_attr_rtc.attr, | 10923 | &dev_attr_rtc.attr, |
10924 | &dev_attr_scan_age.attr, | ||
10925 | &dev_attr_led.attr, | ||
10926 | &dev_attr_speed_scan.attr, | ||
10927 | &dev_attr_net_stats.attr, | ||
6990 | NULL | 10928 | NULL |
6991 | }; | 10929 | }; |
6992 | 10930 | ||
@@ -7002,7 +10940,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7002 | void __iomem *base; | 10940 | void __iomem *base; |
7003 | u32 length, val; | 10941 | u32 length, val; |
7004 | struct ipw_priv *priv; | 10942 | struct ipw_priv *priv; |
7005 | int band, modulation; | 10943 | int i; |
7006 | 10944 | ||
7007 | net_dev = alloc_ieee80211(sizeof(struct ipw_priv)); | 10945 | net_dev = alloc_ieee80211(sizeof(struct ipw_priv)); |
7008 | if (net_dev == NULL) { | 10946 | if (net_dev == NULL) { |
@@ -7012,13 +10950,17 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7012 | 10950 | ||
7013 | priv = ieee80211_priv(net_dev); | 10951 | priv = ieee80211_priv(net_dev); |
7014 | priv->ieee = netdev_priv(net_dev); | 10952 | priv->ieee = netdev_priv(net_dev); |
10953 | |||
7015 | priv->net_dev = net_dev; | 10954 | priv->net_dev = net_dev; |
7016 | priv->pci_dev = pdev; | 10955 | priv->pci_dev = pdev; |
7017 | #ifdef CONFIG_IPW_DEBUG | 10956 | #ifdef CONFIG_IPW_DEBUG |
7018 | ipw_debug_level = debug; | 10957 | ipw_debug_level = debug; |
7019 | #endif | 10958 | #endif |
7020 | spin_lock_init(&priv->lock); | 10959 | spin_lock_init(&priv->lock); |
10960 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) | ||
10961 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); | ||
7021 | 10962 | ||
10963 | init_MUTEX(&priv->sem); | ||
7022 | if (pci_enable_device(pdev)) { | 10964 | if (pci_enable_device(pdev)) { |
7023 | err = -ENODEV; | 10965 | err = -ENODEV; |
7024 | goto out_free_ieee80211; | 10966 | goto out_free_ieee80211; |
@@ -7065,90 +11007,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7065 | goto out_iounmap; | 11007 | goto out_iounmap; |
7066 | } | 11008 | } |
7067 | 11009 | ||
7068 | /* Initialize module parameter values here */ | 11010 | ipw_sw_reset(priv, 1); |
7069 | if (ifname) | ||
7070 | strncpy(net_dev->name, ifname, IFNAMSIZ); | ||
7071 | |||
7072 | if (associate) | ||
7073 | priv->config |= CFG_ASSOCIATE; | ||
7074 | else | ||
7075 | IPW_DEBUG_INFO("Auto associate disabled.\n"); | ||
7076 | |||
7077 | if (auto_create) | ||
7078 | priv->config |= CFG_ADHOC_CREATE; | ||
7079 | else | ||
7080 | IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); | ||
7081 | |||
7082 | if (disable) { | ||
7083 | priv->status |= STATUS_RF_KILL_SW; | ||
7084 | IPW_DEBUG_INFO("Radio disabled.\n"); | ||
7085 | } | ||
7086 | |||
7087 | if (channel != 0) { | ||
7088 | priv->config |= CFG_STATIC_CHANNEL; | ||
7089 | priv->channel = channel; | ||
7090 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); | ||
7091 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); | ||
7092 | /* TODO: Validate that provided channel is in range */ | ||
7093 | } | ||
7094 | |||
7095 | switch (mode) { | ||
7096 | case 1: | ||
7097 | priv->ieee->iw_mode = IW_MODE_ADHOC; | ||
7098 | break; | ||
7099 | #ifdef CONFIG_IPW_PROMISC | ||
7100 | case 2: | ||
7101 | priv->ieee->iw_mode = IW_MODE_MONITOR; | ||
7102 | break; | ||
7103 | #endif | ||
7104 | default: | ||
7105 | case 0: | ||
7106 | priv->ieee->iw_mode = IW_MODE_INFRA; | ||
7107 | break; | ||
7108 | } | ||
7109 | |||
7110 | if ((priv->pci_dev->device == 0x4223) || | ||
7111 | (priv->pci_dev->device == 0x4224)) { | ||
7112 | printk(KERN_INFO DRV_NAME | ||
7113 | ": Detected Intel PRO/Wireless 2915ABG Network " | ||
7114 | "Connection\n"); | ||
7115 | priv->ieee->abg_true = 1; | ||
7116 | band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; | ||
7117 | modulation = IEEE80211_OFDM_MODULATION | | ||
7118 | IEEE80211_CCK_MODULATION; | ||
7119 | priv->adapter = IPW_2915ABG; | ||
7120 | priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; | ||
7121 | } else { | ||
7122 | if (priv->pci_dev->device == 0x4221) | ||
7123 | printk(KERN_INFO DRV_NAME | ||
7124 | ": Detected Intel PRO/Wireless 2225BG Network " | ||
7125 | "Connection\n"); | ||
7126 | else | ||
7127 | printk(KERN_INFO DRV_NAME | ||
7128 | ": Detected Intel PRO/Wireless 2200BG Network " | ||
7129 | "Connection\n"); | ||
7130 | |||
7131 | priv->ieee->abg_true = 0; | ||
7132 | band = IEEE80211_24GHZ_BAND; | ||
7133 | modulation = IEEE80211_OFDM_MODULATION | | ||
7134 | IEEE80211_CCK_MODULATION; | ||
7135 | priv->adapter = IPW_2200BG; | ||
7136 | priv->ieee->mode = IEEE_G | IEEE_B; | ||
7137 | } | ||
7138 | |||
7139 | priv->ieee->freq_band = band; | ||
7140 | priv->ieee->modulation = modulation; | ||
7141 | |||
7142 | priv->rates_mask = IEEE80211_DEFAULT_RATES_MASK; | ||
7143 | |||
7144 | priv->missed_beacon_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; | ||
7145 | priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; | ||
7146 | |||
7147 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; | ||
7148 | |||
7149 | /* If power management is turned on, default to AC mode */ | ||
7150 | priv->power_mode = IPW_POWER_AC; | ||
7151 | priv->tx_power = IPW_DEFAULT_TX_POWER; | ||
7152 | 11011 | ||
7153 | err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, priv); | 11012 | err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, priv); |
7154 | if (err) { | 11013 | if (err) { |
@@ -7159,8 +11018,20 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7159 | SET_MODULE_OWNER(net_dev); | 11018 | SET_MODULE_OWNER(net_dev); |
7160 | SET_NETDEV_DEV(net_dev, &pdev->dev); | 11019 | SET_NETDEV_DEV(net_dev, &pdev->dev); |
7161 | 11020 | ||
11021 | down(&priv->sem); | ||
11022 | |||
7162 | priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; | 11023 | priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; |
7163 | priv->ieee->set_security = shim__set_security; | 11024 | priv->ieee->set_security = shim__set_security; |
11025 | priv->ieee->is_queue_full = ipw_net_is_queue_full; | ||
11026 | |||
11027 | #ifdef CONFIG_IPW_QOS | ||
11028 | priv->ieee->handle_probe_response = ipw_handle_beacon; | ||
11029 | priv->ieee->handle_beacon = ipw_handle_probe_response; | ||
11030 | priv->ieee->handle_assoc_response = ipw_handle_assoc_response; | ||
11031 | #endif /* CONFIG_IPW_QOS */ | ||
11032 | |||
11033 | priv->ieee->perfect_rssi = -20; | ||
11034 | priv->ieee->worst_rssi = -85; | ||
7164 | 11035 | ||
7165 | net_dev->open = ipw_net_open; | 11036 | net_dev->open = ipw_net_open; |
7166 | net_dev->stop = ipw_net_stop; | 11037 | net_dev->stop = ipw_net_stop; |
@@ -7168,7 +11039,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7168 | net_dev->get_stats = ipw_net_get_stats; | 11039 | net_dev->get_stats = ipw_net_get_stats; |
7169 | net_dev->set_multicast_list = ipw_net_set_multicast_list; | 11040 | net_dev->set_multicast_list = ipw_net_set_multicast_list; |
7170 | net_dev->set_mac_address = ipw_net_set_mac_address; | 11041 | net_dev->set_mac_address = ipw_net_set_mac_address; |
7171 | net_dev->get_wireless_stats = ipw_get_wireless_stats; | 11042 | priv->wireless_data.spy_data = &priv->ieee->spy_data; |
11043 | priv->wireless_data.ieee80211 = priv->ieee; | ||
11044 | net_dev->wireless_data = &priv->wireless_data; | ||
7172 | net_dev->wireless_handlers = &ipw_wx_handler_def; | 11045 | net_dev->wireless_handlers = &ipw_wx_handler_def; |
7173 | net_dev->ethtool_ops = &ipw_ethtool_ops; | 11046 | net_dev->ethtool_ops = &ipw_ethtool_ops; |
7174 | net_dev->irq = pdev->irq; | 11047 | net_dev->irq = pdev->irq; |
@@ -7179,18 +11052,19 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7179 | err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); | 11052 | err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); |
7180 | if (err) { | 11053 | if (err) { |
7181 | IPW_ERROR("failed to create sysfs device attributes\n"); | 11054 | IPW_ERROR("failed to create sysfs device attributes\n"); |
11055 | up(&priv->sem); | ||
7182 | goto out_release_irq; | 11056 | goto out_release_irq; |
7183 | } | 11057 | } |
7184 | 11058 | ||
11059 | up(&priv->sem); | ||
7185 | err = register_netdev(net_dev); | 11060 | err = register_netdev(net_dev); |
7186 | if (err) { | 11061 | if (err) { |
7187 | IPW_ERROR("failed to register network device\n"); | 11062 | IPW_ERROR("failed to register network device\n"); |
7188 | goto out_remove_group; | 11063 | goto out_remove_sysfs; |
7189 | } | 11064 | } |
7190 | |||
7191 | return 0; | 11065 | return 0; |
7192 | 11066 | ||
7193 | out_remove_group: | 11067 | out_remove_sysfs: |
7194 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); | 11068 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); |
7195 | out_release_irq: | 11069 | out_release_irq: |
7196 | free_irq(pdev->irq, priv); | 11070 | free_irq(pdev->irq, priv); |
@@ -7213,14 +11087,19 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7213 | static void ipw_pci_remove(struct pci_dev *pdev) | 11087 | static void ipw_pci_remove(struct pci_dev *pdev) |
7214 | { | 11088 | { |
7215 | struct ipw_priv *priv = pci_get_drvdata(pdev); | 11089 | struct ipw_priv *priv = pci_get_drvdata(pdev); |
11090 | struct list_head *p, *q; | ||
11091 | int i; | ||
11092 | |||
7216 | if (!priv) | 11093 | if (!priv) |
7217 | return; | 11094 | return; |
7218 | 11095 | ||
7219 | priv->status |= STATUS_EXIT_PENDING; | 11096 | down(&priv->sem); |
7220 | 11097 | ||
11098 | priv->status |= STATUS_EXIT_PENDING; | ||
11099 | ipw_down(priv); | ||
7221 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); | 11100 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); |
7222 | 11101 | ||
7223 | ipw_down(priv); | 11102 | up(&priv->sem); |
7224 | 11103 | ||
7225 | unregister_netdev(priv->net_dev); | 11104 | unregister_netdev(priv->net_dev); |
7226 | 11105 | ||
@@ -7230,16 +11109,31 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
7230 | } | 11109 | } |
7231 | ipw_tx_queue_free(priv); | 11110 | ipw_tx_queue_free(priv); |
7232 | 11111 | ||
11112 | if (priv->cmdlog) { | ||
11113 | kfree(priv->cmdlog); | ||
11114 | priv->cmdlog = NULL; | ||
11115 | } | ||
7233 | /* ipw_down will ensure that there is no more pending work | 11116 | /* ipw_down will ensure that there is no more pending work |
7234 | * in the workqueue's, so we can safely remove them now. */ | 11117 | * in the workqueue's, so we can safely remove them now. */ |
7235 | if (priv->workqueue) { | 11118 | cancel_delayed_work(&priv->adhoc_check); |
7236 | cancel_delayed_work(&priv->adhoc_check); | 11119 | cancel_delayed_work(&priv->gather_stats); |
7237 | cancel_delayed_work(&priv->gather_stats); | 11120 | cancel_delayed_work(&priv->request_scan); |
7238 | cancel_delayed_work(&priv->request_scan); | 11121 | cancel_delayed_work(&priv->rf_kill); |
7239 | cancel_delayed_work(&priv->rf_kill); | 11122 | cancel_delayed_work(&priv->scan_check); |
7240 | cancel_delayed_work(&priv->scan_check); | 11123 | destroy_workqueue(priv->workqueue); |
7241 | destroy_workqueue(priv->workqueue); | 11124 | priv->workqueue = NULL; |
7242 | priv->workqueue = NULL; | 11125 | |
11126 | /* Free MAC hash list for ADHOC */ | ||
11127 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) { | ||
11128 | list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { | ||
11129 | kfree(list_entry(p, struct ipw_ibss_seq, list)); | ||
11130 | list_del(p); | ||
11131 | } | ||
11132 | } | ||
11133 | |||
11134 | if (priv->error) { | ||
11135 | ipw_free_error_log(priv->error); | ||
11136 | priv->error = NULL; | ||
7243 | } | 11137 | } |
7244 | 11138 | ||
7245 | free_irq(pdev->irq, priv); | 11139 | free_irq(pdev->irq, priv); |
@@ -7248,15 +11142,7 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
7248 | pci_disable_device(pdev); | 11142 | pci_disable_device(pdev); |
7249 | pci_set_drvdata(pdev, NULL); | 11143 | pci_set_drvdata(pdev, NULL); |
7250 | free_ieee80211(priv->net_dev); | 11144 | free_ieee80211(priv->net_dev); |
7251 | 11145 | free_firmware(); | |
7252 | #ifdef CONFIG_PM | ||
7253 | if (fw_loaded) { | ||
7254 | release_firmware(bootfw); | ||
7255 | release_firmware(ucode); | ||
7256 | release_firmware(firmware); | ||
7257 | fw_loaded = 0; | ||
7258 | } | ||
7259 | #endif | ||
7260 | } | 11146 | } |
7261 | 11147 | ||
7262 | #ifdef CONFIG_PM | 11148 | #ifdef CONFIG_PM |
@@ -7288,13 +11174,10 @@ static int ipw_pci_resume(struct pci_dev *pdev) | |||
7288 | 11174 | ||
7289 | printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name); | 11175 | printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name); |
7290 | 11176 | ||
7291 | pci_set_power_state(pdev, 0); | 11177 | pci_set_power_state(pdev, PCI_D0); |
7292 | pci_enable_device(pdev); | 11178 | pci_enable_device(pdev); |
7293 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) | ||
7294 | pci_restore_state(pdev, priv->pm_state); | ||
7295 | #else | ||
7296 | pci_restore_state(pdev); | 11179 | pci_restore_state(pdev); |
7297 | #endif | 11180 | |
7298 | /* | 11181 | /* |
7299 | * Suspend/Resume resets the PCI configuration space, so we have to | 11182 | * Suspend/Resume resets the PCI configuration space, so we have to |
7300 | * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries | 11183 | * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries |
@@ -7366,16 +11249,33 @@ MODULE_PARM_DESC(associate, "auto associate when scanning (default on)"); | |||
7366 | module_param(auto_create, int, 0444); | 11249 | module_param(auto_create, int, 0444); |
7367 | MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)"); | 11250 | MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)"); |
7368 | 11251 | ||
11252 | module_param(led, int, 0444); | ||
11253 | MODULE_PARM_DESC(led, "enable led control on some systems (default 0 off)\n"); | ||
11254 | |||
7369 | module_param(debug, int, 0444); | 11255 | module_param(debug, int, 0444); |
7370 | MODULE_PARM_DESC(debug, "debug output mask"); | 11256 | MODULE_PARM_DESC(debug, "debug output mask"); |
7371 | 11257 | ||
7372 | module_param(channel, int, 0444); | 11258 | module_param(channel, int, 0444); |
7373 | MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); | 11259 | MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); |
7374 | 11260 | ||
7375 | module_param(ifname, charp, 0444); | 11261 | #ifdef CONFIG_IPW_QOS |
7376 | MODULE_PARM_DESC(ifname, "network device name (default eth%d)"); | 11262 | module_param(qos_enable, int, 0444); |
11263 | MODULE_PARM_DESC(qos_enable, "enable all QoS functionalitis"); | ||
11264 | |||
11265 | module_param(qos_burst_enable, int, 0444); | ||
11266 | MODULE_PARM_DESC(qos_burst_enable, "enable QoS burst mode"); | ||
11267 | |||
11268 | module_param(qos_no_ack_mask, int, 0444); | ||
11269 | MODULE_PARM_DESC(qos_no_ack_mask, "mask Tx_Queue to no ack"); | ||
7377 | 11270 | ||
7378 | #ifdef CONFIG_IPW_PROMISC | 11271 | module_param(burst_duration_CCK, int, 0444); |
11272 | MODULE_PARM_DESC(burst_duration_CCK, "set CCK burst value"); | ||
11273 | |||
11274 | module_param(burst_duration_OFDM, int, 0444); | ||
11275 | MODULE_PARM_DESC(burst_duration_OFDM, "set OFDM burst value"); | ||
11276 | #endif /* CONFIG_IPW_QOS */ | ||
11277 | |||
11278 | #ifdef CONFIG_IPW2200_MONITOR | ||
7379 | module_param(mode, int, 0444); | 11279 | module_param(mode, int, 0444); |
7380 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); | 11280 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); |
7381 | #else | 11281 | #else |
@@ -7383,5 +11283,12 @@ module_param(mode, int, 0444); | |||
7383 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); | 11283 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); |
7384 | #endif | 11284 | #endif |
7385 | 11285 | ||
11286 | module_param(hwcrypto, int, 0444); | ||
11287 | MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default on)"); | ||
11288 | |||
11289 | module_param(cmdlog, int, 0444); | ||
11290 | MODULE_PARM_DESC(cmdlog, | ||
11291 | "allocate a ring buffer for logging firmware commands"); | ||
11292 | |||
7386 | module_exit(ipw_exit); | 11293 | module_exit(ipw_exit); |
7387 | module_init(ipw_init); | 11294 | module_init(ipw_init); |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 0873b758f499..1c98db0652c9 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it | 5 | This program is free software; you can redistribute it and/or modify it |
6 | under the terms of version 2 of the GNU General Public License as | 6 | under the terms of version 2 of the GNU General Public License as |
@@ -49,6 +49,7 @@ | |||
49 | #include <asm/io.h> | 49 | #include <asm/io.h> |
50 | 50 | ||
51 | #include <net/ieee80211.h> | 51 | #include <net/ieee80211.h> |
52 | #include <net/ieee80211_radiotap.h> | ||
52 | 53 | ||
53 | #define DRV_NAME "ipw2200" | 54 | #define DRV_NAME "ipw2200" |
54 | 55 | ||
@@ -160,6 +161,16 @@ enum connection_manager_assoc_states { | |||
160 | * TX Queue Flag Definitions | 161 | * TX Queue Flag Definitions |
161 | */ | 162 | */ |
162 | 163 | ||
164 | /* tx wep key definition */ | ||
165 | #define DCT_WEP_KEY_NOT_IMMIDIATE 0x00 | ||
166 | #define DCT_WEP_KEY_64Bit 0x40 | ||
167 | #define DCT_WEP_KEY_128Bit 0x80 | ||
168 | #define DCT_WEP_KEY_128bitIV 0xC0 | ||
169 | #define DCT_WEP_KEY_SIZE_MASK 0xC0 | ||
170 | |||
171 | #define DCT_WEP_KEY_INDEX_MASK 0x0F | ||
172 | #define DCT_WEP_INDEX_USE_IMMEDIATE 0x20 | ||
173 | |||
163 | /* abort attempt if mgmt frame is rx'd */ | 174 | /* abort attempt if mgmt frame is rx'd */ |
164 | #define DCT_FLAG_ABORT_MGMT 0x01 | 175 | #define DCT_FLAG_ABORT_MGMT 0x01 |
165 | 176 | ||
@@ -167,7 +178,8 @@ enum connection_manager_assoc_states { | |||
167 | #define DCT_FLAG_CTS_REQUIRED 0x02 | 178 | #define DCT_FLAG_CTS_REQUIRED 0x02 |
168 | 179 | ||
169 | /* use short preamble */ | 180 | /* use short preamble */ |
170 | #define DCT_FLAG_SHORT_PREMBL 0x04 | 181 | #define DCT_FLAG_LONG_PREAMBLE 0x00 |
182 | #define DCT_FLAG_SHORT_PREAMBLE 0x04 | ||
171 | 183 | ||
172 | /* RTS/CTS first */ | 184 | /* RTS/CTS first */ |
173 | #define DCT_FLAG_RTS_REQD 0x08 | 185 | #define DCT_FLAG_RTS_REQD 0x08 |
@@ -184,9 +196,23 @@ enum connection_manager_assoc_states { | |||
184 | /* ACK rx is expected to follow */ | 196 | /* ACK rx is expected to follow */ |
185 | #define DCT_FLAG_ACK_REQD 0x80 | 197 | #define DCT_FLAG_ACK_REQD 0x80 |
186 | 198 | ||
199 | /* TX flags extension */ | ||
187 | #define DCT_FLAG_EXT_MODE_CCK 0x01 | 200 | #define DCT_FLAG_EXT_MODE_CCK 0x01 |
188 | #define DCT_FLAG_EXT_MODE_OFDM 0x00 | 201 | #define DCT_FLAG_EXT_MODE_OFDM 0x00 |
189 | 202 | ||
203 | #define DCT_FLAG_EXT_SECURITY_WEP 0x00 | ||
204 | #define DCT_FLAG_EXT_SECURITY_NO DCT_FLAG_EXT_SECURITY_WEP | ||
205 | #define DCT_FLAG_EXT_SECURITY_CKIP 0x04 | ||
206 | #define DCT_FLAG_EXT_SECURITY_CCM 0x08 | ||
207 | #define DCT_FLAG_EXT_SECURITY_TKIP 0x0C | ||
208 | #define DCT_FLAG_EXT_SECURITY_MASK 0x0C | ||
209 | |||
210 | #define DCT_FLAG_EXT_QOS_ENABLED 0x10 | ||
211 | |||
212 | #define DCT_FLAG_EXT_HC_NO_SIFS_PIFS 0x00 | ||
213 | #define DCT_FLAG_EXT_HC_SIFS 0x20 | ||
214 | #define DCT_FLAG_EXT_HC_PIFS 0x40 | ||
215 | |||
190 | #define TX_RX_TYPE_MASK 0xFF | 216 | #define TX_RX_TYPE_MASK 0xFF |
191 | #define TX_FRAME_TYPE 0x00 | 217 | #define TX_FRAME_TYPE 0x00 |
192 | #define TX_HOST_COMMAND_TYPE 0x01 | 218 | #define TX_HOST_COMMAND_TYPE 0x01 |
@@ -232,6 +258,117 @@ enum connection_manager_assoc_states { | |||
232 | #define DCR_TYPE_SNIFFER 0x06 | 258 | #define DCR_TYPE_SNIFFER 0x06 |
233 | #define DCR_TYPE_MU_BSS DCR_TYPE_MU_ESS | 259 | #define DCR_TYPE_MU_BSS DCR_TYPE_MU_ESS |
234 | 260 | ||
261 | /* QoS definitions */ | ||
262 | |||
263 | #define CW_MIN_OFDM 15 | ||
264 | #define CW_MAX_OFDM 1023 | ||
265 | #define CW_MIN_CCK 31 | ||
266 | #define CW_MAX_CCK 1023 | ||
267 | |||
268 | #define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM | ||
269 | #define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM | ||
270 | #define QOS_TX2_CW_MIN_OFDM ( (CW_MIN_OFDM + 1) / 2 - 1 ) | ||
271 | #define QOS_TX3_CW_MIN_OFDM ( (CW_MIN_OFDM + 1) / 4 - 1 ) | ||
272 | |||
273 | #define QOS_TX0_CW_MIN_CCK CW_MIN_CCK | ||
274 | #define QOS_TX1_CW_MIN_CCK CW_MIN_CCK | ||
275 | #define QOS_TX2_CW_MIN_CCK ( (CW_MIN_CCK + 1) / 2 - 1 ) | ||
276 | #define QOS_TX3_CW_MIN_CCK ( (CW_MIN_CCK + 1) / 4 - 1 ) | ||
277 | |||
278 | #define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM | ||
279 | #define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM | ||
280 | #define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM | ||
281 | #define QOS_TX3_CW_MAX_OFDM ( (CW_MIN_OFDM + 1) / 2 - 1 ) | ||
282 | |||
283 | #define QOS_TX0_CW_MAX_CCK CW_MAX_CCK | ||
284 | #define QOS_TX1_CW_MAX_CCK CW_MAX_CCK | ||
285 | #define QOS_TX2_CW_MAX_CCK CW_MIN_CCK | ||
286 | #define QOS_TX3_CW_MAX_CCK ( (CW_MIN_CCK + 1) / 2 - 1 ) | ||
287 | |||
288 | #define QOS_TX0_AIFS (3 - QOS_AIFSN_MIN_VALUE) | ||
289 | #define QOS_TX1_AIFS (7 - QOS_AIFSN_MIN_VALUE) | ||
290 | #define QOS_TX2_AIFS (2 - QOS_AIFSN_MIN_VALUE) | ||
291 | #define QOS_TX3_AIFS (2 - QOS_AIFSN_MIN_VALUE) | ||
292 | |||
293 | #define QOS_TX0_ACM 0 | ||
294 | #define QOS_TX1_ACM 0 | ||
295 | #define QOS_TX2_ACM 0 | ||
296 | #define QOS_TX3_ACM 0 | ||
297 | |||
298 | #define QOS_TX0_TXOP_LIMIT_CCK 0 | ||
299 | #define QOS_TX1_TXOP_LIMIT_CCK 0 | ||
300 | #define QOS_TX2_TXOP_LIMIT_CCK 6016 | ||
301 | #define QOS_TX3_TXOP_LIMIT_CCK 3264 | ||
302 | |||
303 | #define QOS_TX0_TXOP_LIMIT_OFDM 0 | ||
304 | #define QOS_TX1_TXOP_LIMIT_OFDM 0 | ||
305 | #define QOS_TX2_TXOP_LIMIT_OFDM 3008 | ||
306 | #define QOS_TX3_TXOP_LIMIT_OFDM 1504 | ||
307 | |||
308 | #define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM | ||
309 | #define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM | ||
310 | #define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM | ||
311 | #define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM | ||
312 | |||
313 | #define DEF_TX0_CW_MIN_CCK CW_MIN_CCK | ||
314 | #define DEF_TX1_CW_MIN_CCK CW_MIN_CCK | ||
315 | #define DEF_TX2_CW_MIN_CCK CW_MIN_CCK | ||
316 | #define DEF_TX3_CW_MIN_CCK CW_MIN_CCK | ||
317 | |||
318 | #define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM | ||
319 | #define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM | ||
320 | #define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM | ||
321 | #define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM | ||
322 | |||
323 | #define DEF_TX0_CW_MAX_CCK CW_MAX_CCK | ||
324 | #define DEF_TX1_CW_MAX_CCK CW_MAX_CCK | ||
325 | #define DEF_TX2_CW_MAX_CCK CW_MAX_CCK | ||
326 | #define DEF_TX3_CW_MAX_CCK CW_MAX_CCK | ||
327 | |||
328 | #define DEF_TX0_AIFS 0 | ||
329 | #define DEF_TX1_AIFS 0 | ||
330 | #define DEF_TX2_AIFS 0 | ||
331 | #define DEF_TX3_AIFS 0 | ||
332 | |||
333 | #define DEF_TX0_ACM 0 | ||
334 | #define DEF_TX1_ACM 0 | ||
335 | #define DEF_TX2_ACM 0 | ||
336 | #define DEF_TX3_ACM 0 | ||
337 | |||
338 | #define DEF_TX0_TXOP_LIMIT_CCK 0 | ||
339 | #define DEF_TX1_TXOP_LIMIT_CCK 0 | ||
340 | #define DEF_TX2_TXOP_LIMIT_CCK 0 | ||
341 | #define DEF_TX3_TXOP_LIMIT_CCK 0 | ||
342 | |||
343 | #define DEF_TX0_TXOP_LIMIT_OFDM 0 | ||
344 | #define DEF_TX1_TXOP_LIMIT_OFDM 0 | ||
345 | #define DEF_TX2_TXOP_LIMIT_OFDM 0 | ||
346 | #define DEF_TX3_TXOP_LIMIT_OFDM 0 | ||
347 | |||
348 | #define QOS_QOS_SETS 3 | ||
349 | #define QOS_PARAM_SET_ACTIVE 0 | ||
350 | #define QOS_PARAM_SET_DEF_CCK 1 | ||
351 | #define QOS_PARAM_SET_DEF_OFDM 2 | ||
352 | |||
353 | #define CTRL_QOS_NO_ACK (0x0020) | ||
354 | |||
355 | #define IPW_TX_QUEUE_1 1 | ||
356 | #define IPW_TX_QUEUE_2 2 | ||
357 | #define IPW_TX_QUEUE_3 3 | ||
358 | #define IPW_TX_QUEUE_4 4 | ||
359 | |||
360 | /* QoS sturctures */ | ||
361 | struct ipw_qos_info { | ||
362 | int qos_enable; | ||
363 | struct ieee80211_qos_parameters *def_qos_parm_OFDM; | ||
364 | struct ieee80211_qos_parameters *def_qos_parm_CCK; | ||
365 | u32 burst_duration_CCK; | ||
366 | u32 burst_duration_OFDM; | ||
367 | u16 qos_no_ack_mask; | ||
368 | int burst_enable; | ||
369 | }; | ||
370 | |||
371 | /**************************************************************/ | ||
235 | /** | 372 | /** |
236 | * Generic queue structure | 373 | * Generic queue structure |
237 | * | 374 | * |
@@ -401,9 +538,9 @@ struct clx2_tx_queue { | |||
401 | #define RX_FREE_BUFFERS 32 | 538 | #define RX_FREE_BUFFERS 32 |
402 | #define RX_LOW_WATERMARK 8 | 539 | #define RX_LOW_WATERMARK 8 |
403 | 540 | ||
404 | #define SUP_RATE_11A_MAX_NUM_CHANNELS (8) | 541 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 |
405 | #define SUP_RATE_11B_MAX_NUM_CHANNELS (4) | 542 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 |
406 | #define SUP_RATE_11G_MAX_NUM_CHANNELS (12) | 543 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 |
407 | 544 | ||
408 | // Used for passing to driver number of successes and failures per rate | 545 | // Used for passing to driver number of successes and failures per rate |
409 | struct rate_histogram { | 546 | struct rate_histogram { |
@@ -452,6 +589,9 @@ struct notif_channel_result { | |||
452 | u8 uReserved; | 589 | u8 uReserved; |
453 | } __attribute__ ((packed)); | 590 | } __attribute__ ((packed)); |
454 | 591 | ||
592 | #define SCAN_COMPLETED_STATUS_COMPLETE 1 | ||
593 | #define SCAN_COMPLETED_STATUS_ABORTED 2 | ||
594 | |||
455 | struct notif_scan_complete { | 595 | struct notif_scan_complete { |
456 | u8 scan_type; | 596 | u8 scan_type; |
457 | u8 num_channels; | 597 | u8 num_channels; |
@@ -562,8 +702,8 @@ struct ipw_rx_packet { | |||
562 | } __attribute__ ((packed)); | 702 | } __attribute__ ((packed)); |
563 | 703 | ||
564 | #define IPW_RX_NOTIFICATION_SIZE sizeof(struct ipw_rx_header) + 12 | 704 | #define IPW_RX_NOTIFICATION_SIZE sizeof(struct ipw_rx_header) + 12 |
565 | #define IPW_RX_FRAME_SIZE sizeof(struct ipw_rx_header) + \ | 705 | #define IPW_RX_FRAME_SIZE (unsigned int)(sizeof(struct ipw_rx_header) + \ |
566 | sizeof(struct ipw_rx_frame) | 706 | sizeof(struct ipw_rx_frame)) |
567 | 707 | ||
568 | struct ipw_rx_mem_buffer { | 708 | struct ipw_rx_mem_buffer { |
569 | dma_addr_t dma_addr; | 709 | dma_addr_t dma_addr; |
@@ -656,6 +796,19 @@ struct ipw_multicast_addr { | |||
656 | u8 mac4[6]; | 796 | u8 mac4[6]; |
657 | } __attribute__ ((packed)); | 797 | } __attribute__ ((packed)); |
658 | 798 | ||
799 | #define DCW_WEP_KEY_INDEX_MASK 0x03 /* bits [0:1] */ | ||
800 | #define DCW_WEP_KEY_SEC_TYPE_MASK 0x30 /* bits [4:5] */ | ||
801 | |||
802 | #define DCW_WEP_KEY_SEC_TYPE_WEP 0x00 | ||
803 | #define DCW_WEP_KEY_SEC_TYPE_CCM 0x20 | ||
804 | #define DCW_WEP_KEY_SEC_TYPE_TKIP 0x30 | ||
805 | |||
806 | #define DCW_WEP_KEY_INVALID_SIZE 0x00 /* 0 = Invalid key */ | ||
807 | #define DCW_WEP_KEY64Bit_SIZE 0x05 /* 64-bit encryption */ | ||
808 | #define DCW_WEP_KEY128Bit_SIZE 0x0D /* 128-bit encryption */ | ||
809 | #define DCW_CCM_KEY128Bit_SIZE 0x10 /* 128-bit key */ | ||
810 | //#define DCW_WEP_KEY128BitIV_SIZE 0x10 /* 128-bit key and 128-bit IV */ | ||
811 | |||
659 | struct ipw_wep_key { | 812 | struct ipw_wep_key { |
660 | u8 cmd_id; | 813 | u8 cmd_id; |
661 | u8 seq_num; | 814 | u8 seq_num; |
@@ -817,14 +970,6 @@ struct ipw_tx_power { | |||
817 | struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; | 970 | struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; |
818 | } __attribute__ ((packed)); | 971 | } __attribute__ ((packed)); |
819 | 972 | ||
820 | struct ipw_qos_parameters { | ||
821 | u16 cw_min[4]; | ||
822 | u16 cw_max[4]; | ||
823 | u8 aifs[4]; | ||
824 | u8 flag[4]; | ||
825 | u16 tx_op_limit[4]; | ||
826 | } __attribute__ ((packed)); | ||
827 | |||
828 | struct ipw_rsn_capabilities { | 973 | struct ipw_rsn_capabilities { |
829 | u8 id; | 974 | u8 id; |
830 | u8 length; | 975 | u8 length; |
@@ -887,6 +1032,10 @@ struct ipw_cmd { | |||
887 | #define STATUS_SCAN_PENDING (1<<20) | 1032 | #define STATUS_SCAN_PENDING (1<<20) |
888 | #define STATUS_SCANNING (1<<21) | 1033 | #define STATUS_SCANNING (1<<21) |
889 | #define STATUS_SCAN_ABORTING (1<<22) | 1034 | #define STATUS_SCAN_ABORTING (1<<22) |
1035 | #define STATUS_SCAN_FORCED (1<<23) | ||
1036 | |||
1037 | #define STATUS_LED_LINK_ON (1<<24) | ||
1038 | #define STATUS_LED_ACT_ON (1<<25) | ||
890 | 1039 | ||
891 | #define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ | 1040 | #define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ |
892 | #define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ | 1041 | #define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ |
@@ -898,11 +1047,15 @@ struct ipw_cmd { | |||
898 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ | 1047 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ |
899 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ | 1048 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ |
900 | #define CFG_CUSTOM_MAC (1<<3) | 1049 | #define CFG_CUSTOM_MAC (1<<3) |
901 | #define CFG_PREAMBLE (1<<4) | 1050 | #define CFG_PREAMBLE_LONG (1<<4) |
902 | #define CFG_ADHOC_PERSIST (1<<5) | 1051 | #define CFG_ADHOC_PERSIST (1<<5) |
903 | #define CFG_ASSOCIATE (1<<6) | 1052 | #define CFG_ASSOCIATE (1<<6) |
904 | #define CFG_FIXED_RATE (1<<7) | 1053 | #define CFG_FIXED_RATE (1<<7) |
905 | #define CFG_ADHOC_CREATE (1<<8) | 1054 | #define CFG_ADHOC_CREATE (1<<8) |
1055 | #define CFG_NO_LED (1<<9) | ||
1056 | #define CFG_BACKGROUND_SCAN (1<<10) | ||
1057 | #define CFG_SPEED_SCAN (1<<11) | ||
1058 | #define CFG_NET_STATS (1<<12) | ||
906 | 1059 | ||
907 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ | 1060 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ |
908 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ | 1061 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ |
@@ -924,13 +1077,50 @@ struct average { | |||
924 | s32 sum; | 1077 | s32 sum; |
925 | }; | 1078 | }; |
926 | 1079 | ||
1080 | #define MAX_SPEED_SCAN 100 | ||
1081 | #define IPW_IBSS_MAC_HASH_SIZE 31 | ||
1082 | |||
1083 | struct ipw_ibss_seq { | ||
1084 | u8 mac[ETH_ALEN]; | ||
1085 | u16 seq_num; | ||
1086 | u16 frag_num; | ||
1087 | unsigned long packet_time; | ||
1088 | struct list_head list; | ||
1089 | }; | ||
1090 | |||
1091 | struct ipw_error_elem { | ||
1092 | u32 desc; | ||
1093 | u32 time; | ||
1094 | u32 blink1; | ||
1095 | u32 blink2; | ||
1096 | u32 link1; | ||
1097 | u32 link2; | ||
1098 | u32 data; | ||
1099 | }; | ||
1100 | |||
1101 | struct ipw_event { | ||
1102 | u32 event; | ||
1103 | u32 time; | ||
1104 | u32 data; | ||
1105 | } __attribute__ ((packed)); | ||
1106 | |||
1107 | struct ipw_fw_error { | ||
1108 | unsigned long jiffies; | ||
1109 | u32 status; | ||
1110 | u32 config; | ||
1111 | u32 elem_len; | ||
1112 | u32 log_len; | ||
1113 | struct ipw_error_elem *elem; | ||
1114 | struct ipw_event *log; | ||
1115 | u8 payload[0]; | ||
1116 | } __attribute__ ((packed)); | ||
1117 | |||
927 | struct ipw_priv { | 1118 | struct ipw_priv { |
928 | /* ieee device used by generic ieee processing code */ | 1119 | /* ieee device used by generic ieee processing code */ |
929 | struct ieee80211_device *ieee; | 1120 | struct ieee80211_device *ieee; |
930 | struct ieee80211_security sec; | ||
931 | 1121 | ||
932 | /* spinlock */ | ||
933 | spinlock_t lock; | 1122 | spinlock_t lock; |
1123 | struct semaphore sem; | ||
934 | 1124 | ||
935 | /* basic pci-network driver stuff */ | 1125 | /* basic pci-network driver stuff */ |
936 | struct pci_dev *pci_dev; | 1126 | struct pci_dev *pci_dev; |
@@ -965,7 +1155,7 @@ struct ipw_priv { | |||
965 | int rx_bufs_min; /**< minimum number of bufs in Rx queue */ | 1155 | int rx_bufs_min; /**< minimum number of bufs in Rx queue */ |
966 | int rx_pend_max; /**< maximum pending buffers for one IRQ */ | 1156 | int rx_pend_max; /**< maximum pending buffers for one IRQ */ |
967 | u32 hcmd_seq; /**< sequence number for hcmd */ | 1157 | u32 hcmd_seq; /**< sequence number for hcmd */ |
968 | u32 missed_beacon_threshold; | 1158 | u32 disassociate_threshold; |
969 | u32 roaming_threshold; | 1159 | u32 roaming_threshold; |
970 | 1160 | ||
971 | struct ipw_associate assoc_request; | 1161 | struct ipw_associate assoc_request; |
@@ -1006,6 +1196,8 @@ struct ipw_priv { | |||
1006 | u8 mac_addr[ETH_ALEN]; | 1196 | u8 mac_addr[ETH_ALEN]; |
1007 | u8 num_stations; | 1197 | u8 num_stations; |
1008 | u8 stations[MAX_STATIONS][ETH_ALEN]; | 1198 | u8 stations[MAX_STATIONS][ETH_ALEN]; |
1199 | u8 short_retry_limit; | ||
1200 | u8 long_retry_limit; | ||
1009 | 1201 | ||
1010 | u32 notif_missed_beacons; | 1202 | u32 notif_missed_beacons; |
1011 | 1203 | ||
@@ -1023,17 +1215,29 @@ struct ipw_priv { | |||
1023 | u32 tx_packets; | 1215 | u32 tx_packets; |
1024 | u32 quality; | 1216 | u32 quality; |
1025 | 1217 | ||
1218 | u8 speed_scan[MAX_SPEED_SCAN]; | ||
1219 | u8 speed_scan_pos; | ||
1220 | |||
1221 | u16 last_seq_num; | ||
1222 | u16 last_frag_num; | ||
1223 | unsigned long last_packet_time; | ||
1224 | struct list_head ibss_mac_hash[IPW_IBSS_MAC_HASH_SIZE]; | ||
1225 | |||
1026 | /* eeprom */ | 1226 | /* eeprom */ |
1027 | u8 eeprom[0x100]; /* 256 bytes of eeprom */ | 1227 | u8 eeprom[0x100]; /* 256 bytes of eeprom */ |
1228 | u8 country[4]; | ||
1028 | int eeprom_delay; | 1229 | int eeprom_delay; |
1029 | 1230 | ||
1030 | struct iw_statistics wstats; | 1231 | struct iw_statistics wstats; |
1031 | 1232 | ||
1233 | struct iw_public_data wireless_data; | ||
1234 | |||
1032 | struct workqueue_struct *workqueue; | 1235 | struct workqueue_struct *workqueue; |
1033 | 1236 | ||
1034 | struct work_struct adhoc_check; | 1237 | struct work_struct adhoc_check; |
1035 | struct work_struct associate; | 1238 | struct work_struct associate; |
1036 | struct work_struct disassociate; | 1239 | struct work_struct disassociate; |
1240 | struct work_struct system_config; | ||
1037 | struct work_struct rx_replenish; | 1241 | struct work_struct rx_replenish; |
1038 | struct work_struct request_scan; | 1242 | struct work_struct request_scan; |
1039 | struct work_struct adapter_restart; | 1243 | struct work_struct adapter_restart; |
@@ -1044,25 +1248,51 @@ struct ipw_priv { | |||
1044 | struct work_struct abort_scan; | 1248 | struct work_struct abort_scan; |
1045 | struct work_struct roam; | 1249 | struct work_struct roam; |
1046 | struct work_struct scan_check; | 1250 | struct work_struct scan_check; |
1251 | struct work_struct link_up; | ||
1252 | struct work_struct link_down; | ||
1047 | 1253 | ||
1048 | struct tasklet_struct irq_tasklet; | 1254 | struct tasklet_struct irq_tasklet; |
1049 | 1255 | ||
1256 | /* LED related variables and work_struct */ | ||
1257 | u8 nic_type; | ||
1258 | u32 led_activity_on; | ||
1259 | u32 led_activity_off; | ||
1260 | u32 led_association_on; | ||
1261 | u32 led_association_off; | ||
1262 | u32 led_ofdm_on; | ||
1263 | u32 led_ofdm_off; | ||
1264 | |||
1265 | struct work_struct led_link_on; | ||
1266 | struct work_struct led_link_off; | ||
1267 | struct work_struct led_act_off; | ||
1268 | struct work_struct merge_networks; | ||
1269 | |||
1270 | struct ipw_cmd_log *cmdlog; | ||
1271 | int cmdlog_len; | ||
1272 | int cmdlog_pos; | ||
1273 | |||
1050 | #define IPW_2200BG 1 | 1274 | #define IPW_2200BG 1 |
1051 | #define IPW_2915ABG 2 | 1275 | #define IPW_2915ABG 2 |
1052 | u8 adapter; | 1276 | u8 adapter; |
1053 | 1277 | ||
1054 | #define IPW_DEFAULT_TX_POWER 0x14 | 1278 | s8 tx_power; |
1055 | u8 tx_power; | ||
1056 | 1279 | ||
1057 | #ifdef CONFIG_PM | 1280 | #ifdef CONFIG_PM |
1058 | u32 pm_state[16]; | 1281 | u32 pm_state[16]; |
1059 | #endif | 1282 | #endif |
1060 | 1283 | ||
1284 | struct ipw_fw_error *error; | ||
1285 | |||
1061 | /* network state */ | 1286 | /* network state */ |
1062 | 1287 | ||
1063 | /* Used to pass the current INTA value from ISR to Tasklet */ | 1288 | /* Used to pass the current INTA value from ISR to Tasklet */ |
1064 | u32 isr_inta; | 1289 | u32 isr_inta; |
1065 | 1290 | ||
1291 | /* QoS */ | ||
1292 | struct ipw_qos_info qos_data; | ||
1293 | struct work_struct qos_activate; | ||
1294 | /*********************************/ | ||
1295 | |||
1066 | /* debugging info */ | 1296 | /* debugging info */ |
1067 | u32 indirect_dword; | 1297 | u32 indirect_dword; |
1068 | u32 direct_dword; | 1298 | u32 direct_dword; |
@@ -1124,6 +1354,8 @@ do { if (ipw_debug_level & (level)) \ | |||
1124 | #define IPW_DL_RF_KILL (1<<17) | 1354 | #define IPW_DL_RF_KILL (1<<17) |
1125 | #define IPW_DL_FW_ERRORS (1<<18) | 1355 | #define IPW_DL_FW_ERRORS (1<<18) |
1126 | 1356 | ||
1357 | #define IPW_DL_LED (1<<19) | ||
1358 | |||
1127 | #define IPW_DL_ORD (1<<20) | 1359 | #define IPW_DL_ORD (1<<20) |
1128 | 1360 | ||
1129 | #define IPW_DL_FRAG (1<<21) | 1361 | #define IPW_DL_FRAG (1<<21) |
@@ -1136,6 +1368,8 @@ do { if (ipw_debug_level & (level)) \ | |||
1136 | #define IPW_DL_TRACE (1<<28) | 1368 | #define IPW_DL_TRACE (1<<28) |
1137 | 1369 | ||
1138 | #define IPW_DL_STATS (1<<29) | 1370 | #define IPW_DL_STATS (1<<29) |
1371 | #define IPW_DL_MERGE (1<<30) | ||
1372 | #define IPW_DL_QOS (1<<31) | ||
1139 | 1373 | ||
1140 | #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) | 1374 | #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) |
1141 | #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) | 1375 | #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) |
@@ -1149,6 +1383,7 @@ do { if (ipw_debug_level & (level)) \ | |||
1149 | #define IPW_DEBUG_TX(f, a...) IPW_DEBUG(IPW_DL_TX, f, ## a) | 1383 | #define IPW_DEBUG_TX(f, a...) IPW_DEBUG(IPW_DL_TX, f, ## a) |
1150 | #define IPW_DEBUG_ISR(f, a...) IPW_DEBUG(IPW_DL_ISR, f, ## a) | 1384 | #define IPW_DEBUG_ISR(f, a...) IPW_DEBUG(IPW_DL_ISR, f, ## a) |
1151 | #define IPW_DEBUG_MANAGEMENT(f, a...) IPW_DEBUG(IPW_DL_MANAGE, f, ## a) | 1385 | #define IPW_DEBUG_MANAGEMENT(f, a...) IPW_DEBUG(IPW_DL_MANAGE, f, ## a) |
1386 | #define IPW_DEBUG_LED(f, a...) IPW_DEBUG(IPW_DL_LED, f, ## a) | ||
1152 | #define IPW_DEBUG_WEP(f, a...) IPW_DEBUG(IPW_DL_WEP, f, ## a) | 1387 | #define IPW_DEBUG_WEP(f, a...) IPW_DEBUG(IPW_DL_WEP, f, ## a) |
1153 | #define IPW_DEBUG_HC(f, a...) IPW_DEBUG(IPW_DL_HOST_COMMAND, f, ## a) | 1388 | #define IPW_DEBUG_HC(f, a...) IPW_DEBUG(IPW_DL_HOST_COMMAND, f, ## a) |
1154 | #define IPW_DEBUG_FRAG(f, a...) IPW_DEBUG(IPW_DL_FRAG, f, ## a) | 1389 | #define IPW_DEBUG_FRAG(f, a...) IPW_DEBUG(IPW_DL_FRAG, f, ## a) |
@@ -1162,6 +1397,8 @@ do { if (ipw_debug_level & (level)) \ | |||
1162 | #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) | 1397 | #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) |
1163 | #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) | 1398 | #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) |
1164 | #define IPW_DEBUG_STATS(f, a...) IPW_DEBUG(IPW_DL_STATS, f, ## a) | 1399 | #define IPW_DEBUG_STATS(f, a...) IPW_DEBUG(IPW_DL_STATS, f, ## a) |
1400 | #define IPW_DEBUG_MERGE(f, a...) IPW_DEBUG(IPW_DL_MERGE, f, ## a) | ||
1401 | #define IPW_DEBUG_QOS(f, a...) IPW_DEBUG(IPW_DL_QOS, f, ## a) | ||
1165 | 1402 | ||
1166 | #include <linux/ctype.h> | 1403 | #include <linux/ctype.h> |
1167 | 1404 | ||
@@ -1176,59 +1413,65 @@ do { if (ipw_debug_level & (level)) \ | |||
1176 | #define DINO_RXFIFO_DATA 0x01 | 1413 | #define DINO_RXFIFO_DATA 0x01 |
1177 | #define DINO_CONTROL_REG 0x00200000 | 1414 | #define DINO_CONTROL_REG 0x00200000 |
1178 | 1415 | ||
1179 | #define CX2_INTA_RW 0x00000008 | 1416 | #define IPW_INTA_RW 0x00000008 |
1180 | #define CX2_INTA_MASK_R 0x0000000C | 1417 | #define IPW_INTA_MASK_R 0x0000000C |
1181 | #define CX2_INDIRECT_ADDR 0x00000010 | 1418 | #define IPW_INDIRECT_ADDR 0x00000010 |
1182 | #define CX2_INDIRECT_DATA 0x00000014 | 1419 | #define IPW_INDIRECT_DATA 0x00000014 |
1183 | #define CX2_AUTOINC_ADDR 0x00000018 | 1420 | #define IPW_AUTOINC_ADDR 0x00000018 |
1184 | #define CX2_AUTOINC_DATA 0x0000001C | 1421 | #define IPW_AUTOINC_DATA 0x0000001C |
1185 | #define CX2_RESET_REG 0x00000020 | 1422 | #define IPW_RESET_REG 0x00000020 |
1186 | #define CX2_GP_CNTRL_RW 0x00000024 | 1423 | #define IPW_GP_CNTRL_RW 0x00000024 |
1187 | 1424 | ||
1188 | #define CX2_READ_INT_REGISTER 0xFF4 | 1425 | #define IPW_READ_INT_REGISTER 0xFF4 |
1189 | 1426 | ||
1190 | #define CX2_GP_CNTRL_BIT_INIT_DONE 0x00000004 | 1427 | #define IPW_GP_CNTRL_BIT_INIT_DONE 0x00000004 |
1191 | 1428 | ||
1192 | #define CX2_REGISTER_DOMAIN1_END 0x00001000 | 1429 | #define IPW_REGISTER_DOMAIN1_END 0x00001000 |
1193 | #define CX2_SRAM_READ_INT_REGISTER 0x00000ff4 | 1430 | #define IPW_SRAM_READ_INT_REGISTER 0x00000ff4 |
1194 | 1431 | ||
1195 | #define CX2_SHARED_LOWER_BOUND 0x00000200 | 1432 | #define IPW_SHARED_LOWER_BOUND 0x00000200 |
1196 | #define CX2_INTERRUPT_AREA_LOWER_BOUND 0x00000f80 | 1433 | #define IPW_INTERRUPT_AREA_LOWER_BOUND 0x00000f80 |
1197 | 1434 | ||
1198 | #define CX2_NIC_SRAM_LOWER_BOUND 0x00000000 | 1435 | #define IPW_NIC_SRAM_LOWER_BOUND 0x00000000 |
1199 | #define CX2_NIC_SRAM_UPPER_BOUND 0x00030000 | 1436 | #define IPW_NIC_SRAM_UPPER_BOUND 0x00030000 |
1200 | 1437 | ||
1201 | #define CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER (1 << 29) | 1438 | #define IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER (1 << 29) |
1202 | #define CX2_GP_CNTRL_BIT_CLOCK_READY 0x00000001 | 1439 | #define IPW_GP_CNTRL_BIT_CLOCK_READY 0x00000001 |
1203 | #define CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY 0x00000002 | 1440 | #define IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY 0x00000002 |
1204 | 1441 | ||
1205 | /* | 1442 | /* |
1206 | * RESET Register Bit Indexes | 1443 | * RESET Register Bit Indexes |
1207 | */ | 1444 | */ |
1208 | #define CBD_RESET_REG_PRINCETON_RESET 0x00000001 /* Bit 0 (LSB) */ | 1445 | #define CBD_RESET_REG_PRINCETON_RESET (1<<0) |
1209 | #define CX2_RESET_REG_SW_RESET 0x00000080 /* Bit 7 */ | 1446 | #define IPW_START_STANDBY (1<<2) |
1210 | #define CX2_RESET_REG_MASTER_DISABLED 0x00000100 /* Bit 8 */ | 1447 | #define IPW_ACTIVITY_LED (1<<4) |
1211 | #define CX2_RESET_REG_STOP_MASTER 0x00000200 /* Bit 9 */ | 1448 | #define IPW_ASSOCIATED_LED (1<<5) |
1212 | #define CX2_ARC_KESHET_CONFIG 0x08000000 /* Bit 27 */ | 1449 | #define IPW_OFDM_LED (1<<6) |
1213 | #define CX2_START_STANDBY 0x00000004 /* Bit 2 */ | 1450 | #define IPW_RESET_REG_SW_RESET (1<<7) |
1214 | 1451 | #define IPW_RESET_REG_MASTER_DISABLED (1<<8) | |
1215 | #define CX2_CSR_CIS_UPPER_BOUND 0x00000200 | 1452 | #define IPW_RESET_REG_STOP_MASTER (1<<9) |
1216 | #define CX2_DOMAIN_0_END 0x1000 | 1453 | #define IPW_GATE_ODMA (1<<25) |
1454 | #define IPW_GATE_IDMA (1<<26) | ||
1455 | #define IPW_ARC_KESHET_CONFIG (1<<27) | ||
1456 | #define IPW_GATE_ADMA (1<<29) | ||
1457 | |||
1458 | #define IPW_CSR_CIS_UPPER_BOUND 0x00000200 | ||
1459 | #define IPW_DOMAIN_0_END 0x1000 | ||
1217 | #define CLX_MEM_BAR_SIZE 0x1000 | 1460 | #define CLX_MEM_BAR_SIZE 0x1000 |
1218 | 1461 | ||
1219 | #define CX2_BASEBAND_CONTROL_STATUS 0X00200000 | 1462 | #define IPW_BASEBAND_CONTROL_STATUS 0X00200000 |
1220 | #define CX2_BASEBAND_TX_FIFO_WRITE 0X00200004 | 1463 | #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 |
1221 | #define CX2_BASEBAND_RX_FIFO_READ 0X00200004 | 1464 | #define IPW_BASEBAND_RX_FIFO_READ 0X00200004 |
1222 | #define CX2_BASEBAND_CONTROL_STORE 0X00200010 | 1465 | #define IPW_BASEBAND_CONTROL_STORE 0X00200010 |
1223 | 1466 | ||
1224 | #define CX2_INTERNAL_CMD_EVENT 0X00300004 | 1467 | #define IPW_INTERNAL_CMD_EVENT 0X00300004 |
1225 | #define CX2_BASEBAND_POWER_DOWN 0x00000001 | 1468 | #define IPW_BASEBAND_POWER_DOWN 0x00000001 |
1226 | 1469 | ||
1227 | #define CX2_MEM_HALT_AND_RESET 0x003000e0 | 1470 | #define IPW_MEM_HALT_AND_RESET 0x003000e0 |
1228 | 1471 | ||
1229 | /* defgroup bits_halt_reset MEM_HALT_AND_RESET register bits */ | 1472 | /* defgroup bits_halt_reset MEM_HALT_AND_RESET register bits */ |
1230 | #define CX2_BIT_HALT_RESET_ON 0x80000000 | 1473 | #define IPW_BIT_HALT_RESET_ON 0x80000000 |
1231 | #define CX2_BIT_HALT_RESET_OFF 0x00000000 | 1474 | #define IPW_BIT_HALT_RESET_OFF 0x00000000 |
1232 | 1475 | ||
1233 | #define CB_LAST_VALID 0x20000000 | 1476 | #define CB_LAST_VALID 0x20000000 |
1234 | #define CB_INT_ENABLED 0x40000000 | 1477 | #define CB_INT_ENABLED 0x40000000 |
@@ -1247,63 +1490,63 @@ do { if (ipw_debug_level & (level)) \ | |||
1247 | #define DMA_CB_STOP_AND_ABORT 0x00000C00 | 1490 | #define DMA_CB_STOP_AND_ABORT 0x00000C00 |
1248 | #define DMA_CB_START 0x00000100 | 1491 | #define DMA_CB_START 0x00000100 |
1249 | 1492 | ||
1250 | #define CX2_SHARED_SRAM_SIZE 0x00030000 | 1493 | #define IPW_SHARED_SRAM_SIZE 0x00030000 |
1251 | #define CX2_SHARED_SRAM_DMA_CONTROL 0x00027000 | 1494 | #define IPW_SHARED_SRAM_DMA_CONTROL 0x00027000 |
1252 | #define CB_MAX_LENGTH 0x1FFF | 1495 | #define CB_MAX_LENGTH 0x1FFF |
1253 | 1496 | ||
1254 | #define CX2_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 | 1497 | #define IPW_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 |
1255 | #define CX2_EEPROM_IMAGE_SIZE 0x100 | 1498 | #define IPW_EEPROM_IMAGE_SIZE 0x100 |
1256 | 1499 | ||
1257 | /* DMA defs */ | 1500 | /* DMA defs */ |
1258 | #define CX2_DMA_I_CURRENT_CB 0x003000D0 | 1501 | #define IPW_DMA_I_CURRENT_CB 0x003000D0 |
1259 | #define CX2_DMA_O_CURRENT_CB 0x003000D4 | 1502 | #define IPW_DMA_O_CURRENT_CB 0x003000D4 |
1260 | #define CX2_DMA_I_DMA_CONTROL 0x003000A4 | 1503 | #define IPW_DMA_I_DMA_CONTROL 0x003000A4 |
1261 | #define CX2_DMA_I_CB_BASE 0x003000A0 | 1504 | #define IPW_DMA_I_CB_BASE 0x003000A0 |
1262 | 1505 | ||
1263 | #define CX2_TX_CMD_QUEUE_BD_BASE (0x00000200) | 1506 | #define IPW_TX_CMD_QUEUE_BD_BASE 0x00000200 |
1264 | #define CX2_TX_CMD_QUEUE_BD_SIZE (0x00000204) | 1507 | #define IPW_TX_CMD_QUEUE_BD_SIZE 0x00000204 |
1265 | #define CX2_TX_QUEUE_0_BD_BASE (0x00000208) | 1508 | #define IPW_TX_QUEUE_0_BD_BASE 0x00000208 |
1266 | #define CX2_TX_QUEUE_0_BD_SIZE (0x0000020C) | 1509 | #define IPW_TX_QUEUE_0_BD_SIZE (0x0000020C) |
1267 | #define CX2_TX_QUEUE_1_BD_BASE (0x00000210) | 1510 | #define IPW_TX_QUEUE_1_BD_BASE 0x00000210 |
1268 | #define CX2_TX_QUEUE_1_BD_SIZE (0x00000214) | 1511 | #define IPW_TX_QUEUE_1_BD_SIZE 0x00000214 |
1269 | #define CX2_TX_QUEUE_2_BD_BASE (0x00000218) | 1512 | #define IPW_TX_QUEUE_2_BD_BASE 0x00000218 |
1270 | #define CX2_TX_QUEUE_2_BD_SIZE (0x0000021C) | 1513 | #define IPW_TX_QUEUE_2_BD_SIZE (0x0000021C) |
1271 | #define CX2_TX_QUEUE_3_BD_BASE (0x00000220) | 1514 | #define IPW_TX_QUEUE_3_BD_BASE 0x00000220 |
1272 | #define CX2_TX_QUEUE_3_BD_SIZE (0x00000224) | 1515 | #define IPW_TX_QUEUE_3_BD_SIZE 0x00000224 |
1273 | #define CX2_RX_BD_BASE (0x00000240) | 1516 | #define IPW_RX_BD_BASE 0x00000240 |
1274 | #define CX2_RX_BD_SIZE (0x00000244) | 1517 | #define IPW_RX_BD_SIZE 0x00000244 |
1275 | #define CX2_RFDS_TABLE_LOWER (0x00000500) | 1518 | #define IPW_RFDS_TABLE_LOWER 0x00000500 |
1276 | 1519 | ||
1277 | #define CX2_TX_CMD_QUEUE_READ_INDEX (0x00000280) | 1520 | #define IPW_TX_CMD_QUEUE_READ_INDEX 0x00000280 |
1278 | #define CX2_TX_QUEUE_0_READ_INDEX (0x00000284) | 1521 | #define IPW_TX_QUEUE_0_READ_INDEX 0x00000284 |
1279 | #define CX2_TX_QUEUE_1_READ_INDEX (0x00000288) | 1522 | #define IPW_TX_QUEUE_1_READ_INDEX 0x00000288 |
1280 | #define CX2_TX_QUEUE_2_READ_INDEX (0x0000028C) | 1523 | #define IPW_TX_QUEUE_2_READ_INDEX (0x0000028C) |
1281 | #define CX2_TX_QUEUE_3_READ_INDEX (0x00000290) | 1524 | #define IPW_TX_QUEUE_3_READ_INDEX 0x00000290 |
1282 | #define CX2_RX_READ_INDEX (0x000002A0) | 1525 | #define IPW_RX_READ_INDEX (0x000002A0) |
1283 | 1526 | ||
1284 | #define CX2_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80) | 1527 | #define IPW_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80) |
1285 | #define CX2_TX_QUEUE_0_WRITE_INDEX (0x00000F84) | 1528 | #define IPW_TX_QUEUE_0_WRITE_INDEX (0x00000F84) |
1286 | #define CX2_TX_QUEUE_1_WRITE_INDEX (0x00000F88) | 1529 | #define IPW_TX_QUEUE_1_WRITE_INDEX (0x00000F88) |
1287 | #define CX2_TX_QUEUE_2_WRITE_INDEX (0x00000F8C) | 1530 | #define IPW_TX_QUEUE_2_WRITE_INDEX (0x00000F8C) |
1288 | #define CX2_TX_QUEUE_3_WRITE_INDEX (0x00000F90) | 1531 | #define IPW_TX_QUEUE_3_WRITE_INDEX (0x00000F90) |
1289 | #define CX2_RX_WRITE_INDEX (0x00000FA0) | 1532 | #define IPW_RX_WRITE_INDEX (0x00000FA0) |
1290 | 1533 | ||
1291 | /* | 1534 | /* |
1292 | * EEPROM Related Definitions | 1535 | * EEPROM Related Definitions |
1293 | */ | 1536 | */ |
1294 | 1537 | ||
1295 | #define IPW_EEPROM_DATA_SRAM_ADDRESS (CX2_SHARED_LOWER_BOUND + 0x814) | 1538 | #define IPW_EEPROM_DATA_SRAM_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x814) |
1296 | #define IPW_EEPROM_DATA_SRAM_SIZE (CX2_SHARED_LOWER_BOUND + 0x818) | 1539 | #define IPW_EEPROM_DATA_SRAM_SIZE (IPW_SHARED_LOWER_BOUND + 0x818) |
1297 | #define IPW_EEPROM_LOAD_DISABLE (CX2_SHARED_LOWER_BOUND + 0x81C) | 1540 | #define IPW_EEPROM_LOAD_DISABLE (IPW_SHARED_LOWER_BOUND + 0x81C) |
1298 | #define IPW_EEPROM_DATA (CX2_SHARED_LOWER_BOUND + 0x820) | 1541 | #define IPW_EEPROM_DATA (IPW_SHARED_LOWER_BOUND + 0x820) |
1299 | #define IPW_EEPROM_UPPER_ADDRESS (CX2_SHARED_LOWER_BOUND + 0x9E0) | 1542 | #define IPW_EEPROM_UPPER_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x9E0) |
1300 | 1543 | ||
1301 | #define IPW_STATION_TABLE_LOWER (CX2_SHARED_LOWER_BOUND + 0xA0C) | 1544 | #define IPW_STATION_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0xA0C) |
1302 | #define IPW_STATION_TABLE_UPPER (CX2_SHARED_LOWER_BOUND + 0xB0C) | 1545 | #define IPW_STATION_TABLE_UPPER (IPW_SHARED_LOWER_BOUND + 0xB0C) |
1303 | #define IPW_REQUEST_ATIM (CX2_SHARED_LOWER_BOUND + 0xB0C) | 1546 | #define IPW_REQUEST_ATIM (IPW_SHARED_LOWER_BOUND + 0xB0C) |
1304 | #define IPW_ATIM_SENT (CX2_SHARED_LOWER_BOUND + 0xB10) | 1547 | #define IPW_ATIM_SENT (IPW_SHARED_LOWER_BOUND + 0xB10) |
1305 | #define IPW_WHO_IS_AWAKE (CX2_SHARED_LOWER_BOUND + 0xB14) | 1548 | #define IPW_WHO_IS_AWAKE (IPW_SHARED_LOWER_BOUND + 0xB14) |
1306 | #define IPW_DURING_ATIM_WINDOW (CX2_SHARED_LOWER_BOUND + 0xB18) | 1549 | #define IPW_DURING_ATIM_WINDOW (IPW_SHARED_LOWER_BOUND + 0xB18) |
1307 | 1550 | ||
1308 | #define MSB 1 | 1551 | #define MSB 1 |
1309 | #define LSB 0 | 1552 | #define LSB 0 |
@@ -1325,15 +1568,15 @@ do { if (ipw_debug_level & (level)) \ | |||
1325 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ | 1568 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ |
1326 | 1569 | ||
1327 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ | 1570 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ |
1328 | #define EEPROM_NIC_TYPE_STANDARD 0 | 1571 | #define EEPROM_NIC_TYPE_0 0 |
1329 | #define EEPROM_NIC_TYPE_DELL 1 | 1572 | #define EEPROM_NIC_TYPE_1 1 |
1330 | #define EEPROM_NIC_TYPE_FUJITSU 2 | 1573 | #define EEPROM_NIC_TYPE_2 2 |
1331 | #define EEPROM_NIC_TYPE_IBM 3 | 1574 | #define EEPROM_NIC_TYPE_3 3 |
1332 | #define EEPROM_NIC_TYPE_HP 4 | 1575 | #define EEPROM_NIC_TYPE_4 4 |
1333 | 1576 | ||
1334 | #define FW_MEM_REG_LOWER_BOUND 0x00300000 | 1577 | #define FW_MEM_REG_LOWER_BOUND 0x00300000 |
1335 | #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) | 1578 | #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) |
1336 | 1579 | #define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) | |
1337 | #define EEPROM_BIT_SK (1<<0) | 1580 | #define EEPROM_BIT_SK (1<<0) |
1338 | #define EEPROM_BIT_CS (1<<1) | 1581 | #define EEPROM_BIT_CS (1<<1) |
1339 | #define EEPROM_BIT_DI (1<<2) | 1582 | #define EEPROM_BIT_DI (1<<2) |
@@ -1342,50 +1585,47 @@ do { if (ipw_debug_level & (level)) \ | |||
1342 | #define EEPROM_CMD_READ 0x2 | 1585 | #define EEPROM_CMD_READ 0x2 |
1343 | 1586 | ||
1344 | /* Interrupts masks */ | 1587 | /* Interrupts masks */ |
1345 | #define CX2_INTA_NONE 0x00000000 | 1588 | #define IPW_INTA_NONE 0x00000000 |
1346 | 1589 | ||
1347 | #define CX2_INTA_BIT_RX_TRANSFER 0x00000002 | 1590 | #define IPW_INTA_BIT_RX_TRANSFER 0x00000002 |
1348 | #define CX2_INTA_BIT_STATUS_CHANGE 0x00000010 | 1591 | #define IPW_INTA_BIT_STATUS_CHANGE 0x00000010 |
1349 | #define CX2_INTA_BIT_BEACON_PERIOD_EXPIRED 0x00000020 | 1592 | #define IPW_INTA_BIT_BEACON_PERIOD_EXPIRED 0x00000020 |
1350 | 1593 | ||
1351 | //Inta Bits for CF | 1594 | //Inta Bits for CF |
1352 | #define CX2_INTA_BIT_TX_CMD_QUEUE 0x00000800 | 1595 | #define IPW_INTA_BIT_TX_CMD_QUEUE 0x00000800 |
1353 | #define CX2_INTA_BIT_TX_QUEUE_1 0x00001000 | 1596 | #define IPW_INTA_BIT_TX_QUEUE_1 0x00001000 |
1354 | #define CX2_INTA_BIT_TX_QUEUE_2 0x00002000 | 1597 | #define IPW_INTA_BIT_TX_QUEUE_2 0x00002000 |
1355 | #define CX2_INTA_BIT_TX_QUEUE_3 0x00004000 | 1598 | #define IPW_INTA_BIT_TX_QUEUE_3 0x00004000 |
1356 | #define CX2_INTA_BIT_TX_QUEUE_4 0x00008000 | 1599 | #define IPW_INTA_BIT_TX_QUEUE_4 0x00008000 |
1357 | 1600 | ||
1358 | #define CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE 0x00010000 | 1601 | #define IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE 0x00010000 |
1359 | 1602 | ||
1360 | #define CX2_INTA_BIT_PREPARE_FOR_POWER_DOWN 0x00100000 | 1603 | #define IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN 0x00100000 |
1361 | #define CX2_INTA_BIT_POWER_DOWN 0x00200000 | 1604 | #define IPW_INTA_BIT_POWER_DOWN 0x00200000 |
1362 | 1605 | ||
1363 | #define CX2_INTA_BIT_FW_INITIALIZATION_DONE 0x01000000 | 1606 | #define IPW_INTA_BIT_FW_INITIALIZATION_DONE 0x01000000 |
1364 | #define CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE 0x02000000 | 1607 | #define IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE 0x02000000 |
1365 | #define CX2_INTA_BIT_RF_KILL_DONE 0x04000000 | 1608 | #define IPW_INTA_BIT_RF_KILL_DONE 0x04000000 |
1366 | #define CX2_INTA_BIT_FATAL_ERROR 0x40000000 | 1609 | #define IPW_INTA_BIT_FATAL_ERROR 0x40000000 |
1367 | #define CX2_INTA_BIT_PARITY_ERROR 0x80000000 | 1610 | #define IPW_INTA_BIT_PARITY_ERROR 0x80000000 |
1368 | 1611 | ||
1369 | /* Interrupts enabled at init time. */ | 1612 | /* Interrupts enabled at init time. */ |
1370 | #define CX2_INTA_MASK_ALL \ | 1613 | #define IPW_INTA_MASK_ALL \ |
1371 | (CX2_INTA_BIT_TX_QUEUE_1 | \ | 1614 | (IPW_INTA_BIT_TX_QUEUE_1 | \ |
1372 | CX2_INTA_BIT_TX_QUEUE_2 | \ | 1615 | IPW_INTA_BIT_TX_QUEUE_2 | \ |
1373 | CX2_INTA_BIT_TX_QUEUE_3 | \ | 1616 | IPW_INTA_BIT_TX_QUEUE_3 | \ |
1374 | CX2_INTA_BIT_TX_QUEUE_4 | \ | 1617 | IPW_INTA_BIT_TX_QUEUE_4 | \ |
1375 | CX2_INTA_BIT_TX_CMD_QUEUE | \ | 1618 | IPW_INTA_BIT_TX_CMD_QUEUE | \ |
1376 | CX2_INTA_BIT_RX_TRANSFER | \ | 1619 | IPW_INTA_BIT_RX_TRANSFER | \ |
1377 | CX2_INTA_BIT_FATAL_ERROR | \ | 1620 | IPW_INTA_BIT_FATAL_ERROR | \ |
1378 | CX2_INTA_BIT_PARITY_ERROR | \ | 1621 | IPW_INTA_BIT_PARITY_ERROR | \ |
1379 | CX2_INTA_BIT_STATUS_CHANGE | \ | 1622 | IPW_INTA_BIT_STATUS_CHANGE | \ |
1380 | CX2_INTA_BIT_FW_INITIALIZATION_DONE | \ | 1623 | IPW_INTA_BIT_FW_INITIALIZATION_DONE | \ |
1381 | CX2_INTA_BIT_BEACON_PERIOD_EXPIRED | \ | 1624 | IPW_INTA_BIT_BEACON_PERIOD_EXPIRED | \ |
1382 | CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE | \ | 1625 | IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE | \ |
1383 | CX2_INTA_BIT_PREPARE_FOR_POWER_DOWN | \ | 1626 | IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN | \ |
1384 | CX2_INTA_BIT_POWER_DOWN | \ | 1627 | IPW_INTA_BIT_POWER_DOWN | \ |
1385 | CX2_INTA_BIT_RF_KILL_DONE ) | 1628 | IPW_INTA_BIT_RF_KILL_DONE ) |
1386 | |||
1387 | #define IPWSTATUS_ERROR_LOG (CX2_SHARED_LOWER_BOUND + 0x410) | ||
1388 | #define IPW_EVENT_LOG (CX2_SHARED_LOWER_BOUND + 0x414) | ||
1389 | 1629 | ||
1390 | /* FW event log definitions */ | 1630 | /* FW event log definitions */ |
1391 | #define EVENT_ELEM_SIZE (3 * sizeof(u32)) | 1631 | #define EVENT_ELEM_SIZE (3 * sizeof(u32)) |
@@ -1395,6 +1635,11 @@ do { if (ipw_debug_level & (level)) \ | |||
1395 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) | 1635 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) |
1396 | #define ERROR_START_OFFSET (1 * sizeof(u32)) | 1636 | #define ERROR_START_OFFSET (1 * sizeof(u32)) |
1397 | 1637 | ||
1638 | /* TX power level (dbm) */ | ||
1639 | #define IPW_TX_POWER_MIN -12 | ||
1640 | #define IPW_TX_POWER_MAX 20 | ||
1641 | #define IPW_TX_POWER_DEFAULT IPW_TX_POWER_MAX | ||
1642 | |||
1398 | enum { | 1643 | enum { |
1399 | IPW_FW_ERROR_OK = 0, | 1644 | IPW_FW_ERROR_OK = 0, |
1400 | IPW_FW_ERROR_FAIL, | 1645 | IPW_FW_ERROR_FAIL, |
@@ -1407,8 +1652,8 @@ enum { | |||
1407 | IPW_FW_ERROR_ALLOC_FAIL, | 1652 | IPW_FW_ERROR_ALLOC_FAIL, |
1408 | IPW_FW_ERROR_DMA_UNDERRUN, | 1653 | IPW_FW_ERROR_DMA_UNDERRUN, |
1409 | IPW_FW_ERROR_DMA_STATUS, | 1654 | IPW_FW_ERROR_DMA_STATUS, |
1410 | IPW_FW_ERROR_DINOSTATUS_ERROR, | 1655 | IPW_FW_ERROR_DINO_ERROR, |
1411 | IPW_FW_ERROR_EEPROMSTATUS_ERROR, | 1656 | IPW_FW_ERROR_EEPROM_ERROR, |
1412 | IPW_FW_ERROR_SYSASSERT, | 1657 | IPW_FW_ERROR_SYSASSERT, |
1413 | IPW_FW_ERROR_FATAL_ERROR | 1658 | IPW_FW_ERROR_FATAL_ERROR |
1414 | }; | 1659 | }; |
@@ -1424,6 +1669,8 @@ enum { | |||
1424 | #define HC_IBSS_RECONF 4 | 1669 | #define HC_IBSS_RECONF 4 |
1425 | #define HC_DISASSOC_QUIET 5 | 1670 | #define HC_DISASSOC_QUIET 5 |
1426 | 1671 | ||
1672 | #define HC_QOS_SUPPORT_ASSOC 0x01 | ||
1673 | |||
1427 | #define IPW_RATE_CAPABILITIES 1 | 1674 | #define IPW_RATE_CAPABILITIES 1 |
1428 | #define IPW_RATE_CONNECT 0 | 1675 | #define IPW_RATE_CONNECT 0 |
1429 | 1676 | ||
@@ -1594,18 +1841,20 @@ enum { | |||
1594 | IPW_ORD_TABLE_7_LAST | 1841 | IPW_ORD_TABLE_7_LAST |
1595 | }; | 1842 | }; |
1596 | 1843 | ||
1597 | #define IPW_ORDINALS_TABLE_LOWER (CX2_SHARED_LOWER_BOUND + 0x500) | 1844 | #define IPW_ERROR_LOG (IPW_SHARED_LOWER_BOUND + 0x410) |
1598 | #define IPW_ORDINALS_TABLE_0 (CX2_SHARED_LOWER_BOUND + 0x180) | 1845 | #define IPW_EVENT_LOG (IPW_SHARED_LOWER_BOUND + 0x414) |
1599 | #define IPW_ORDINALS_TABLE_1 (CX2_SHARED_LOWER_BOUND + 0x184) | 1846 | #define IPW_ORDINALS_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0x500) |
1600 | #define IPW_ORDINALS_TABLE_2 (CX2_SHARED_LOWER_BOUND + 0x188) | 1847 | #define IPW_ORDINALS_TABLE_0 (IPW_SHARED_LOWER_BOUND + 0x180) |
1601 | #define IPW_MEM_FIXED_OVERRIDE (CX2_SHARED_LOWER_BOUND + 0x41C) | 1848 | #define IPW_ORDINALS_TABLE_1 (IPW_SHARED_LOWER_BOUND + 0x184) |
1849 | #define IPW_ORDINALS_TABLE_2 (IPW_SHARED_LOWER_BOUND + 0x188) | ||
1850 | #define IPW_MEM_FIXED_OVERRIDE (IPW_SHARED_LOWER_BOUND + 0x41C) | ||
1602 | 1851 | ||
1603 | struct ipw_fixed_rate { | 1852 | struct ipw_fixed_rate { |
1604 | u16 tx_rates; | 1853 | u16 tx_rates; |
1605 | u16 reserved; | 1854 | u16 reserved; |
1606 | } __attribute__ ((packed)); | 1855 | } __attribute__ ((packed)); |
1607 | 1856 | ||
1608 | #define CX2_INDIRECT_ADDR_MASK (~0x3ul) | 1857 | #define IPW_INDIRECT_ADDR_MASK (~0x3ul) |
1609 | 1858 | ||
1610 | struct host_cmd { | 1859 | struct host_cmd { |
1611 | u8 cmd; | 1860 | u8 cmd; |
@@ -1614,6 +1863,12 @@ struct host_cmd { | |||
1614 | u32 param[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; | 1863 | u32 param[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; |
1615 | } __attribute__ ((packed)); | 1864 | } __attribute__ ((packed)); |
1616 | 1865 | ||
1866 | struct ipw_cmd_log { | ||
1867 | unsigned long jiffies; | ||
1868 | int retcode; | ||
1869 | struct host_cmd cmd; | ||
1870 | }; | ||
1871 | |||
1617 | #define CFG_BT_COEXISTENCE_MIN 0x00 | 1872 | #define CFG_BT_COEXISTENCE_MIN 0x00 |
1618 | #define CFG_BT_COEXISTENCE_DEFER 0x02 | 1873 | #define CFG_BT_COEXISTENCE_DEFER 0x02 |
1619 | #define CFG_BT_COEXISTENCE_KILL 0x04 | 1874 | #define CFG_BT_COEXISTENCE_KILL 0x04 |
@@ -1642,15 +1897,6 @@ struct host_cmd { | |||
1642 | #define REG_CHANNEL_MASK 0x00003FFF | 1897 | #define REG_CHANNEL_MASK 0x00003FFF |
1643 | #define IPW_IBSS_11B_DEFAULT_MASK 0x87ff | 1898 | #define IPW_IBSS_11B_DEFAULT_MASK 0x87ff |
1644 | 1899 | ||
1645 | static const long ipw_frequencies[] = { | ||
1646 | 2412, 2417, 2422, 2427, | ||
1647 | 2432, 2437, 2442, 2447, | ||
1648 | 2452, 2457, 2462, 2467, | ||
1649 | 2472, 2484 | ||
1650 | }; | ||
1651 | |||
1652 | #define FREQ_COUNT ARRAY_SIZE(ipw_frequencies) | ||
1653 | |||
1654 | #define IPW_MAX_CONFIG_RETRIES 10 | 1900 | #define IPW_MAX_CONFIG_RETRIES 10 |
1655 | 1901 | ||
1656 | static inline u32 frame_hdr_len(struct ieee80211_hdr_4addr *hdr) | 1902 | static inline u32 frame_hdr_len(struct ieee80211_hdr_4addr *hdr) |
diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index aaa958798f3f..109a96d90007 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c | |||
@@ -111,9 +111,10 @@ isl38xx_handle_wakeup(isl38xx_control_block *control_block, | |||
111 | void | 111 | void |
112 | isl38xx_trigger_device(int asleep, void __iomem *device_base) | 112 | isl38xx_trigger_device(int asleep, void __iomem *device_base) |
113 | { | 113 | { |
114 | u32 reg, counter = 0; | 114 | u32 reg; |
115 | 115 | ||
116 | #if VERBOSE > SHOW_ERROR_MESSAGES | 116 | #if VERBOSE > SHOW_ERROR_MESSAGES |
117 | u32 counter = 0; | ||
117 | struct timeval current_time; | 118 | struct timeval current_time; |
118 | DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); | 119 | DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); |
119 | #endif | 120 | #endif |
@@ -130,7 +131,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
130 | current_time.tv_sec, (long)current_time.tv_usec, | 131 | current_time.tv_sec, (long)current_time.tv_usec, |
131 | readl(device_base + ISL38XX_CTRL_STAT_REG)); | 132 | readl(device_base + ISL38XX_CTRL_STAT_REG)); |
132 | #endif | 133 | #endif |
133 | udelay(ISL38XX_WRITEIO_DELAY); | ||
134 | 134 | ||
135 | reg = readl(device_base + ISL38XX_INT_IDENT_REG); | 135 | reg = readl(device_base + ISL38XX_INT_IDENT_REG); |
136 | if (reg == 0xabadface) { | 136 | if (reg == 0xabadface) { |
@@ -144,7 +144,9 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
144 | while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG), | 144 | while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG), |
145 | (reg & ISL38XX_CTRL_STAT_SLEEPMODE) == 0) { | 145 | (reg & ISL38XX_CTRL_STAT_SLEEPMODE) == 0) { |
146 | udelay(ISL38XX_WRITEIO_DELAY); | 146 | udelay(ISL38XX_WRITEIO_DELAY); |
147 | #if VERBOSE > SHOW_ERROR_MESSAGES | ||
147 | counter++; | 148 | counter++; |
149 | #endif | ||
148 | } | 150 | } |
149 | 151 | ||
150 | #if VERBOSE > SHOW_ERROR_MESSAGES | 152 | #if VERBOSE > SHOW_ERROR_MESSAGES |
@@ -152,10 +154,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
152 | "%08li.%08li Device register read %08x\n", | 154 | "%08li.%08li Device register read %08x\n", |
153 | current_time.tv_sec, (long)current_time.tv_usec, | 155 | current_time.tv_sec, (long)current_time.tv_usec, |
154 | readl(device_base + ISL38XX_CTRL_STAT_REG)); | 156 | readl(device_base + ISL38XX_CTRL_STAT_REG)); |
155 | #endif | ||
156 | udelay(ISL38XX_WRITEIO_DELAY); | ||
157 | |||
158 | #if VERBOSE > SHOW_ERROR_MESSAGES | ||
159 | do_gettimeofday(¤t_time); | 157 | do_gettimeofday(¤t_time); |
160 | DEBUG(SHOW_TRACING, | 158 | DEBUG(SHOW_TRACING, |
161 | "%08li.%08li Device asleep counter %i\n", | 159 | "%08li.%08li Device asleep counter %i\n", |
@@ -170,7 +168,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
170 | 168 | ||
171 | /* perform another read on the Device Status Register */ | 169 | /* perform another read on the Device Status Register */ |
172 | reg = readl(device_base + ISL38XX_CTRL_STAT_REG); | 170 | reg = readl(device_base + ISL38XX_CTRL_STAT_REG); |
173 | udelay(ISL38XX_WRITEIO_DELAY); | ||
174 | 171 | ||
175 | #if VERBOSE > SHOW_ERROR_MESSAGES | 172 | #if VERBOSE > SHOW_ERROR_MESSAGES |
176 | do_gettimeofday(¤t_time); | 173 | do_gettimeofday(¤t_time); |
@@ -186,7 +183,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
186 | 183 | ||
187 | isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_UPDATE, | 184 | isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_UPDATE, |
188 | ISL38XX_DEV_INT_REG); | 185 | ISL38XX_DEV_INT_REG); |
189 | udelay(ISL38XX_WRITEIO_DELAY); | ||
190 | } | 186 | } |
191 | } | 187 | } |
192 | 188 | ||
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index 80ae081ab4b7..33d64d2ee53f 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c | |||
@@ -226,17 +226,17 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |||
226 | priv->data_low_tx_full = 1; | 226 | priv->data_low_tx_full = 1; |
227 | } | 227 | } |
228 | 228 | ||
229 | /* set the transmission time */ | ||
230 | ndev->trans_start = jiffies; | ||
231 | priv->statistics.tx_packets++; | ||
232 | priv->statistics.tx_bytes += skb->len; | ||
233 | |||
229 | /* trigger the device */ | 234 | /* trigger the device */ |
230 | islpci_trigger(priv); | 235 | islpci_trigger(priv); |
231 | 236 | ||
232 | /* unlock the driver code */ | 237 | /* unlock the driver code */ |
233 | spin_unlock_irqrestore(&priv->slock, flags); | 238 | spin_unlock_irqrestore(&priv->slock, flags); |
234 | 239 | ||
235 | /* set the transmission time */ | ||
236 | ndev->trans_start = jiffies; | ||
237 | priv->statistics.tx_packets++; | ||
238 | priv->statistics.tx_bytes += skb->len; | ||
239 | |||
240 | return 0; | 240 | return 0; |
241 | 241 | ||
242 | drop_free: | 242 | drop_free: |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 4b3c98f5c564..c822cad3333f 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -4608,9 +4608,8 @@ wavelan_attach(void) | |||
4608 | #endif | 4608 | #endif |
4609 | 4609 | ||
4610 | /* Initialize the dev_link_t structure */ | 4610 | /* Initialize the dev_link_t structure */ |
4611 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 4611 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
4612 | if (!link) return NULL; | 4612 | if (!link) return NULL; |
4613 | memset(link, 0, sizeof(struct dev_link_t)); | ||
4614 | 4613 | ||
4615 | /* The io structure describes IO port mapping */ | 4614 | /* The io structure describes IO port mapping */ |
4616 | link->io.NumPorts1 = 8; | 4615 | link->io.NumPorts1 = 8; |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 3f8c27f0871b..978fdc606781 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -1965,10 +1965,9 @@ static dev_link_t *wl3501_attach(void) | |||
1965 | int ret; | 1965 | int ret; |
1966 | 1966 | ||
1967 | /* Initialize the dev_link_t structure */ | 1967 | /* Initialize the dev_link_t structure */ |
1968 | link = kmalloc(sizeof(*link), GFP_KERNEL); | 1968 | link = kzalloc(sizeof(*link), GFP_KERNEL); |
1969 | if (!link) | 1969 | if (!link) |
1970 | goto out; | 1970 | goto out; |
1971 | memset(link, 0, sizeof(struct dev_link_t)); | ||
1972 | 1971 | ||
1973 | /* The io structure describes IO port mapping */ | 1972 | /* The io structure describes IO port mapping */ |
1974 | link->io.NumPorts1 = 16; | 1973 | link->io.NumPorts1 = 16; |
diff --git a/include/linux/eeprom.h b/include/linux/eeprom.h deleted file mode 100644 index 38afd9da1dfe..000000000000 --- a/include/linux/eeprom.h +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /* credit winbond-840.c | ||
2 | */ | ||
3 | #include <asm/io.h> | ||
4 | struct eeprom_ops { | ||
5 | void (*set_cs)(void *ee); | ||
6 | void (*clear_cs)(void *ee); | ||
7 | }; | ||
8 | |||
9 | #define EEPOL_EEDI 0x01 | ||
10 | #define EEPOL_EEDO 0x02 | ||
11 | #define EEPOL_EECLK 0x04 | ||
12 | #define EEPOL_EESEL 0x08 | ||
13 | |||
14 | struct eeprom { | ||
15 | void *dev; | ||
16 | struct eeprom_ops *ops; | ||
17 | |||
18 | void __iomem * addr; | ||
19 | |||
20 | unsigned ee_addr_bits; | ||
21 | |||
22 | unsigned eesel; | ||
23 | unsigned eeclk; | ||
24 | unsigned eedo; | ||
25 | unsigned eedi; | ||
26 | unsigned polarity; | ||
27 | unsigned ee_state; | ||
28 | |||
29 | spinlock_t *lock; | ||
30 | u32 *cache; | ||
31 | }; | ||
32 | |||
33 | |||
34 | u8 eeprom_readb(struct eeprom *ee, unsigned address); | ||
35 | void eeprom_read(struct eeprom *ee, unsigned address, u8 *bytes, | ||
36 | unsigned count); | ||
37 | void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data); | ||
38 | void eeprom_write(struct eeprom *ee, unsigned address, u8 *bytes, | ||
39 | unsigned count); | ||
40 | |||
41 | /* The EEPROM commands include the alway-set leading bit. */ | ||
42 | enum EEPROM_Cmds { | ||
43 | EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), | ||
44 | }; | ||
45 | |||
46 | void setup_ee_mem_bitbanger(struct eeprom *ee, void __iomem *memaddr, int eesel_bit, int eeclk_bit, int eedo_bit, int eedi_bit, unsigned polarity) | ||
47 | { | ||
48 | ee->addr = memaddr; | ||
49 | ee->eesel = 1 << eesel_bit; | ||
50 | ee->eeclk = 1 << eeclk_bit; | ||
51 | ee->eedo = 1 << eedo_bit; | ||
52 | ee->eedi = 1 << eedi_bit; | ||
53 | |||
54 | ee->polarity = polarity; | ||
55 | |||
56 | *ee->cache = readl(ee->addr); | ||
57 | } | ||
58 | |||
59 | /* foo. put this in a .c file */ | ||
60 | static inline void eeprom_update(struct eeprom *ee, u32 mask, int pol) | ||
61 | { | ||
62 | unsigned long flags; | ||
63 | u32 data; | ||
64 | |||
65 | spin_lock_irqsave(ee->lock, flags); | ||
66 | data = *ee->cache; | ||
67 | |||
68 | data &= ~mask; | ||
69 | if (pol) | ||
70 | data |= mask; | ||
71 | |||
72 | *ee->cache = data; | ||
73 | //printk("update: %08x\n", data); | ||
74 | writel(data, ee->addr); | ||
75 | spin_unlock_irqrestore(ee->lock, flags); | ||
76 | } | ||
77 | |||
78 | void eeprom_clk_lo(struct eeprom *ee) | ||
79 | { | ||
80 | int pol = !!(ee->polarity & EEPOL_EECLK); | ||
81 | |||
82 | eeprom_update(ee, ee->eeclk, pol); | ||
83 | udelay(2); | ||
84 | } | ||
85 | |||
86 | void eeprom_clk_hi(struct eeprom *ee) | ||
87 | { | ||
88 | int pol = !!(ee->polarity & EEPOL_EECLK); | ||
89 | |||
90 | eeprom_update(ee, ee->eeclk, !pol); | ||
91 | udelay(2); | ||
92 | } | ||
93 | |||
94 | void eeprom_send_addr(struct eeprom *ee, unsigned address) | ||
95 | { | ||
96 | int pol = !!(ee->polarity & EEPOL_EEDI); | ||
97 | unsigned i; | ||
98 | address |= 6 << 6; | ||
99 | |||
100 | /* Shift the read command bits out. */ | ||
101 | for (i=0; i<11; i++) { | ||
102 | eeprom_update(ee, ee->eedi, ((address >> 10) & 1) ^ pol); | ||
103 | address <<= 1; | ||
104 | eeprom_clk_hi(ee); | ||
105 | eeprom_clk_lo(ee); | ||
106 | } | ||
107 | eeprom_update(ee, ee->eedi, pol); | ||
108 | } | ||
109 | |||
110 | u16 eeprom_readw(struct eeprom *ee, unsigned address) | ||
111 | { | ||
112 | unsigned i; | ||
113 | u16 res = 0; | ||
114 | |||
115 | eeprom_clk_lo(ee); | ||
116 | eeprom_update(ee, ee->eesel, 1 ^ !!(ee->polarity & EEPOL_EESEL)); | ||
117 | eeprom_send_addr(ee, address); | ||
118 | |||
119 | for (i=0; i<16; i++) { | ||
120 | u32 data; | ||
121 | eeprom_clk_hi(ee); | ||
122 | res <<= 1; | ||
123 | data = readl(ee->addr); | ||
124 | //printk("eeprom_readw: %08x\n", data); | ||
125 | res |= !!(data & ee->eedo) ^ !!(ee->polarity & EEPOL_EEDO); | ||
126 | eeprom_clk_lo(ee); | ||
127 | } | ||
128 | eeprom_update(ee, ee->eesel, 0 ^ !!(ee->polarity & EEPOL_EESEL)); | ||
129 | |||
130 | return res; | ||
131 | } | ||
132 | |||
133 | |||
134 | void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data) | ||
135 | { | ||
136 | } | ||
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 5e38dca1d082..b93fd8c1d884 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/kernel.h> /* ARRAY_SIZE */ | 29 | #include <linux/kernel.h> /* ARRAY_SIZE */ |
30 | #include <linux/wireless.h> | 30 | #include <linux/wireless.h> |
31 | 31 | ||
32 | #define IEEE80211_VERSION "git-1.1.6" | 32 | #define IEEE80211_VERSION "git-1.1.7" |
33 | 33 | ||
34 | #define IEEE80211_DATA_LEN 2304 | 34 | #define IEEE80211_DATA_LEN 2304 |
35 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | 35 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index 0a1c2d82ca4b..225fc751d464 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h | |||
@@ -31,6 +31,7 @@ enum { | |||
31 | 31 | ||
32 | struct ieee80211_crypto_ops { | 32 | struct ieee80211_crypto_ops { |
33 | const char *name; | 33 | const char *name; |
34 | struct list_head list; | ||
34 | 35 | ||
35 | /* init new crypto context (e.g., allocate private data space, | 36 | /* init new crypto context (e.g., allocate private data space, |
36 | * select IV, etc.); returns NULL on failure or pointer to allocated | 37 | * select IV, etc.); returns NULL on failure or pointer to allocated |
diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c index 20cc580a07e0..ecc9bb196abc 100644 --- a/net/ieee80211/ieee80211_crypt.c +++ b/net/ieee80211/ieee80211_crypt.c | |||
@@ -11,15 +11,14 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <asm/string.h> | 18 | #include <linux/string.h> |
19 | #include <asm/errno.h> | ||
20 | |||
21 | #include <net/ieee80211.h> | 19 | #include <net/ieee80211.h> |
22 | 20 | ||
21 | |||
23 | MODULE_AUTHOR("Jouni Malinen"); | 22 | MODULE_AUTHOR("Jouni Malinen"); |
24 | MODULE_DESCRIPTION("HostAP crypto"); | 23 | MODULE_DESCRIPTION("HostAP crypto"); |
25 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
@@ -29,32 +28,20 @@ struct ieee80211_crypto_alg { | |||
29 | struct ieee80211_crypto_ops *ops; | 28 | struct ieee80211_crypto_ops *ops; |
30 | }; | 29 | }; |
31 | 30 | ||
32 | struct ieee80211_crypto { | 31 | static LIST_HEAD(ieee80211_crypto_algs); |
33 | struct list_head algs; | 32 | static DEFINE_SPINLOCK(ieee80211_crypto_lock); |
34 | spinlock_t lock; | ||
35 | }; | ||
36 | |||
37 | static struct ieee80211_crypto *hcrypt; | ||
38 | 33 | ||
39 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) | 34 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) |
40 | { | 35 | { |
41 | struct list_head *ptr, *n; | 36 | struct ieee80211_crypt_data *entry, *next; |
42 | struct ieee80211_crypt_data *entry; | ||
43 | unsigned long flags; | 37 | unsigned long flags; |
44 | 38 | ||
45 | spin_lock_irqsave(&ieee->lock, flags); | 39 | spin_lock_irqsave(&ieee->lock, flags); |
46 | 40 | list_for_each_entry_safe(entry, next, &ieee->crypt_deinit_list, list) { | |
47 | if (list_empty(&ieee->crypt_deinit_list)) | ||
48 | goto unlock; | ||
49 | |||
50 | for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; | ||
51 | ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { | ||
52 | entry = list_entry(ptr, struct ieee80211_crypt_data, list); | ||
53 | |||
54 | if (atomic_read(&entry->refcnt) != 0 && !force) | 41 | if (atomic_read(&entry->refcnt) != 0 && !force) |
55 | continue; | 42 | continue; |
56 | 43 | ||
57 | list_del(ptr); | 44 | list_del(&entry->list); |
58 | 45 | ||
59 | if (entry->ops) { | 46 | if (entry->ops) { |
60 | entry->ops->deinit(entry->priv); | 47 | entry->ops->deinit(entry->priv); |
@@ -62,7 +49,6 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) | |||
62 | } | 49 | } |
63 | kfree(entry); | 50 | kfree(entry); |
64 | } | 51 | } |
65 | unlock: | ||
66 | spin_unlock_irqrestore(&ieee->lock, flags); | 52 | spin_unlock_irqrestore(&ieee->lock, flags); |
67 | } | 53 | } |
68 | 54 | ||
@@ -125,9 +111,6 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
125 | unsigned long flags; | 111 | unsigned long flags; |
126 | struct ieee80211_crypto_alg *alg; | 112 | struct ieee80211_crypto_alg *alg; |
127 | 113 | ||
128 | if (hcrypt == NULL) | ||
129 | return -1; | ||
130 | |||
131 | alg = kmalloc(sizeof(*alg), GFP_KERNEL); | 114 | alg = kmalloc(sizeof(*alg), GFP_KERNEL); |
132 | if (alg == NULL) | 115 | if (alg == NULL) |
133 | return -ENOMEM; | 116 | return -ENOMEM; |
@@ -135,9 +118,9 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
135 | memset(alg, 0, sizeof(*alg)); | 118 | memset(alg, 0, sizeof(*alg)); |
136 | alg->ops = ops; | 119 | alg->ops = ops; |
137 | 120 | ||
138 | spin_lock_irqsave(&hcrypt->lock, flags); | 121 | spin_lock_irqsave(&ieee80211_crypto_lock, flags); |
139 | list_add(&alg->list, &hcrypt->algs); | 122 | list_add(&alg->list, &ieee80211_crypto_algs); |
140 | spin_unlock_irqrestore(&hcrypt->lock, flags); | 123 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
141 | 124 | ||
142 | printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", | 125 | printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", |
143 | ops->name); | 126 | ops->name); |
@@ -147,64 +130,49 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
147 | 130 | ||
148 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) | 131 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) |
149 | { | 132 | { |
133 | struct ieee80211_crypto_alg *alg; | ||
150 | unsigned long flags; | 134 | unsigned long flags; |
151 | struct list_head *ptr; | ||
152 | struct ieee80211_crypto_alg *del_alg = NULL; | ||
153 | |||
154 | if (hcrypt == NULL) | ||
155 | return -1; | ||
156 | |||
157 | spin_lock_irqsave(&hcrypt->lock, flags); | ||
158 | for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { | ||
159 | struct ieee80211_crypto_alg *alg = | ||
160 | (struct ieee80211_crypto_alg *)ptr; | ||
161 | if (alg->ops == ops) { | ||
162 | list_del(&alg->list); | ||
163 | del_alg = alg; | ||
164 | break; | ||
165 | } | ||
166 | } | ||
167 | spin_unlock_irqrestore(&hcrypt->lock, flags); | ||
168 | 135 | ||
169 | if (del_alg) { | 136 | spin_lock_irqsave(&ieee80211_crypto_lock, flags); |
170 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " | 137 | list_for_each_entry(alg, &ieee80211_crypto_algs, list) { |
171 | "'%s'\n", ops->name); | 138 | if (alg->ops == ops) |
172 | kfree(del_alg); | 139 | goto found; |
173 | } | 140 | } |
174 | 141 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | |
175 | return del_alg ? 0 : -1; | 142 | return -EINVAL; |
143 | |||
144 | found: | ||
145 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " | ||
146 | "'%s'\n", ops->name); | ||
147 | list_del(&alg->list); | ||
148 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); | ||
149 | kfree(alg); | ||
150 | return 0; | ||
176 | } | 151 | } |
177 | 152 | ||
178 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) | 153 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) |
179 | { | 154 | { |
155 | struct ieee80211_crypto_alg *alg; | ||
180 | unsigned long flags; | 156 | unsigned long flags; |
181 | struct list_head *ptr; | 157 | |
182 | struct ieee80211_crypto_alg *found_alg = NULL; | 158 | spin_lock_irqsave(&ieee80211_crypto_lock, flags); |
183 | 159 | list_for_each_entry(alg, &ieee80211_crypto_algs, list) { | |
184 | if (hcrypt == NULL) | 160 | if (strcmp(alg->ops->name, name) == 0) |
185 | return NULL; | 161 | goto found; |
186 | |||
187 | spin_lock_irqsave(&hcrypt->lock, flags); | ||
188 | for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { | ||
189 | struct ieee80211_crypto_alg *alg = | ||
190 | (struct ieee80211_crypto_alg *)ptr; | ||
191 | if (strcmp(alg->ops->name, name) == 0) { | ||
192 | found_alg = alg; | ||
193 | break; | ||
194 | } | ||
195 | } | 162 | } |
196 | spin_unlock_irqrestore(&hcrypt->lock, flags); | 163 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
164 | return NULL; | ||
197 | 165 | ||
198 | if (found_alg) | 166 | found: |
199 | return found_alg->ops; | 167 | spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); |
200 | else | 168 | return alg->ops; |
201 | return NULL; | ||
202 | } | 169 | } |
203 | 170 | ||
204 | static void *ieee80211_crypt_null_init(int keyidx) | 171 | static void *ieee80211_crypt_null_init(int keyidx) |
205 | { | 172 | { |
206 | return (void *)1; | 173 | return (void *)1; |
207 | } | 174 | } |
175 | |||
208 | static void ieee80211_crypt_null_deinit(void *priv) | 176 | static void ieee80211_crypt_null_deinit(void *priv) |
209 | { | 177 | { |
210 | } | 178 | } |
@@ -213,56 +181,18 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = { | |||
213 | .name = "NULL", | 181 | .name = "NULL", |
214 | .init = ieee80211_crypt_null_init, | 182 | .init = ieee80211_crypt_null_init, |
215 | .deinit = ieee80211_crypt_null_deinit, | 183 | .deinit = ieee80211_crypt_null_deinit, |
216 | .encrypt_mpdu = NULL, | ||
217 | .decrypt_mpdu = NULL, | ||
218 | .encrypt_msdu = NULL, | ||
219 | .decrypt_msdu = NULL, | ||
220 | .set_key = NULL, | ||
221 | .get_key = NULL, | ||
222 | .extra_mpdu_prefix_len = 0, | ||
223 | .extra_mpdu_postfix_len = 0, | ||
224 | .owner = THIS_MODULE, | 184 | .owner = THIS_MODULE, |
225 | }; | 185 | }; |
226 | 186 | ||
227 | static int __init ieee80211_crypto_init(void) | 187 | static int __init ieee80211_crypto_init(void) |
228 | { | 188 | { |
229 | int ret = -ENOMEM; | 189 | return ieee80211_register_crypto_ops(&ieee80211_crypt_null); |
230 | |||
231 | hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL); | ||
232 | if (!hcrypt) | ||
233 | goto out; | ||
234 | |||
235 | memset(hcrypt, 0, sizeof(*hcrypt)); | ||
236 | INIT_LIST_HEAD(&hcrypt->algs); | ||
237 | spin_lock_init(&hcrypt->lock); | ||
238 | |||
239 | ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null); | ||
240 | if (ret < 0) { | ||
241 | kfree(hcrypt); | ||
242 | hcrypt = NULL; | ||
243 | } | ||
244 | out: | ||
245 | return ret; | ||
246 | } | 190 | } |
247 | 191 | ||
248 | static void __exit ieee80211_crypto_deinit(void) | 192 | static void __exit ieee80211_crypto_deinit(void) |
249 | { | 193 | { |
250 | struct list_head *ptr, *n; | 194 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_null); |
251 | 195 | BUG_ON(!list_empty(&ieee80211_crypto_algs)); | |
252 | if (hcrypt == NULL) | ||
253 | return; | ||
254 | |||
255 | for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; | ||
256 | ptr = n, n = ptr->next) { | ||
257 | struct ieee80211_crypto_alg *alg = | ||
258 | (struct ieee80211_crypto_alg *)ptr; | ||
259 | list_del(ptr); | ||
260 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " | ||
261 | "'%s' (deinit)\n", alg->ops->name); | ||
262 | kfree(alg); | ||
263 | } | ||
264 | |||
265 | kfree(hcrypt); | ||
266 | } | 196 | } |
267 | 197 | ||
268 | EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); | 198 | EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 6ad88218f573..03efaacbdb73 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -369,6 +369,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
369 | /* Put this code here so that we avoid duplicating it in all | 369 | /* Put this code here so that we avoid duplicating it in all |
370 | * Rx paths. - Jean II */ | 370 | * Rx paths. - Jean II */ |
371 | #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ | 371 | #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ |
372 | #ifdef CONFIG_NET_RADIO | ||
372 | /* If spy monitoring on */ | 373 | /* If spy monitoring on */ |
373 | if (ieee->spy_data.spy_number > 0) { | 374 | if (ieee->spy_data.spy_number > 0) { |
374 | struct iw_quality wstats; | 375 | struct iw_quality wstats; |
@@ -395,6 +396,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
395 | /* Update spy records */ | 396 | /* Update spy records */ |
396 | wireless_spy_update(ieee->dev, hdr->addr2, &wstats); | 397 | wireless_spy_update(ieee->dev, hdr->addr2, &wstats); |
397 | } | 398 | } |
399 | #endif /* CONFIG_NET_RADIO */ | ||
398 | #endif /* IW_WIRELESS_SPY */ | 400 | #endif /* IW_WIRELESS_SPY */ |
399 | 401 | ||
400 | #ifdef NOT_YET | 402 | #ifdef NOT_YET |
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 1ce7af9bec35..181755f2aa8b 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -161,9 +161,11 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
161 | (ieee->perfect_rssi - ieee->worst_rssi) - | 161 | (ieee->perfect_rssi - ieee->worst_rssi) - |
162 | (ieee->perfect_rssi - network->stats.rssi) * | 162 | (ieee->perfect_rssi - network->stats.rssi) * |
163 | (15 * (ieee->perfect_rssi - ieee->worst_rssi) + | 163 | (15 * (ieee->perfect_rssi - ieee->worst_rssi) + |
164 | 62 * (ieee->perfect_rssi - network->stats.rssi))) / | 164 | 62 * (ieee->perfect_rssi - |
165 | ((ieee->perfect_rssi - ieee->worst_rssi) * | 165 | network->stats.rssi))) / |
166 | (ieee->perfect_rssi - ieee->worst_rssi)); | 166 | ((ieee->perfect_rssi - |
167 | ieee->worst_rssi) * (ieee->perfect_rssi - | ||
168 | ieee->worst_rssi)); | ||
167 | if (iwe.u.qual.qual > 100) | 169 | if (iwe.u.qual.qual > 100) |
168 | iwe.u.qual.qual = 100; | 170 | iwe.u.qual.qual = 100; |
169 | else if (iwe.u.qual.qual < 1) | 171 | else if (iwe.u.qual.qual < 1) |
@@ -520,7 +522,8 @@ int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee, | |||
520 | crypt = &ieee->crypt[idx]; | 522 | crypt = &ieee->crypt[idx]; |
521 | group_key = 1; | 523 | group_key = 1; |
522 | } else { | 524 | } else { |
523 | if (idx != 0) | 525 | /* some Cisco APs use idx>0 for unicast in dynamic WEP */ |
526 | if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) | ||
524 | return -EINVAL; | 527 | return -EINVAL; |
525 | if (ieee->iw_mode == IW_MODE_INFRA) | 528 | if (ieee->iw_mode == IW_MODE_INFRA) |
526 | crypt = &ieee->crypt[idx]; | 529 | crypt = &ieee->crypt[idx]; |
@@ -688,7 +691,8 @@ int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, | |||
688 | } else | 691 | } else |
689 | idx = ieee->tx_keyidx; | 692 | idx = ieee->tx_keyidx; |
690 | 693 | ||
691 | if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) | 694 | if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && |
695 | ext->alg != IW_ENCODE_ALG_WEP) | ||
692 | if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA) | 696 | if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA) |
693 | return -EINVAL; | 697 | return -EINVAL; |
694 | 698 | ||