Parent Directory
|
Revision Log
Re-revert at76_usb to version from before attempted mac80211 port
| 1 | commit 3316a19c45ab4408455958dd91aa4d50cbd38a4a |
| 2 | Author: Pavel Roskin <proski@gnu.org> |
| 3 | Date: Mon Feb 4 00:05:19 2008 -0500 |
| 4 | |
| 5 | at76_usb: Add ID for Uniden PCW100 |
| 6 | |
| 7 | Tested and reported by Lior Silberman. |
| 8 | |
| 9 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 10 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 11 | |
| 12 | commit 82477a6ce80732630ee2a37119d0341ec95dda1b |
| 13 | Author: Pavel Roskin <proski@gnu.org> |
| 14 | Date: Sun Sep 30 14:41:25 2007 -0400 |
| 15 | |
| 16 | [PATCH] at76_usb: Add ID for at76c503a based CNETUSB611 |
| 17 | |
| 18 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 19 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 20 | |
| 21 | commit 29fde48679696cbf51536f4fe477dcafd382c89c |
| 22 | Author: Pavel Roskin <proski@gnu.org> |
| 23 | Date: Sun Sep 30 14:41:18 2007 -0400 |
| 24 | |
| 25 | [PATCH] at76_usb: Bump version to 0.17 |
| 26 | |
| 27 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 28 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 29 | |
| 30 | commit a518a5d9a5a7ad29293366e73a3bc395d7417102 |
| 31 | Author: Pavel Roskin <proski@gnu.org> |
| 32 | Date: Sun Sep 30 14:41:12 2007 -0400 |
| 33 | |
| 34 | [PATCH] at76_usb: Use ETH_P_802_2 in monitor mode |
| 35 | |
| 36 | It's used by most other wireless drivers, including mac80211. |
| 37 | ETH_P_80211_RAW is obsolete. |
| 38 | |
| 39 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 40 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 41 | |
| 42 | commit 77809e77886d8507109be71c47fc93081a853348 |
| 43 | Author: Pavel Roskin <proski@gnu.org> |
| 44 | Date: Sun Sep 30 14:41:06 2007 -0400 |
| 45 | |
| 46 | [PATCH] at76_usb: Be more verbose on startup |
| 47 | |
| 48 | Promote some debug messages from at76_dbg() to unconditional KERN_DEBUG. |
| 49 | Use dev_printk() before the device is registered, as "wlan%d" doesn't |
| 50 | identify the device uniquely. |
| 51 | |
| 52 | Print firmware name and version when it's loaded from file. Print |
| 53 | firmware version reported by the card. Print USB address and network |
| 54 | device name on the same line to help identifying the device. |
| 55 | |
| 56 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 57 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 58 | |
| 59 | commit faaca95f9e608a1f63ba9273965afb26e329e701 |
| 60 | Author: Pavel Roskin <proski@gnu.org> |
| 61 | Date: Sun Sep 30 14:40:59 2007 -0400 |
| 62 | |
| 63 | [PATCH] at76_usb: Use dev_printk() where possible |
| 64 | |
| 65 | dev_printk() prints the USB device name in addition to the driver name, |
| 66 | which makes it easier to understand the diagnostics in case of multiple |
| 67 | devices. |
| 68 | |
| 69 | Use &interface->dev, as it's more specific and includes the driver name, |
| 70 | but use &udev->dev if interface is not available. |
| 71 | |
| 72 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 73 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 74 | |
| 75 | commit 6cd24cdbdffd1b325357e7d59935744f90946602 |
| 76 | Author: Pavel Roskin <proski@gnu.org> |
| 77 | Date: Sun Sep 30 14:40:53 2007 -0400 |
| 78 | |
| 79 | [PATCH] at76_usb: Remove incorrect firmware version check |
| 80 | |
| 81 | The major version of the firmware reported by the device can mismatch |
| 82 | the version of the originally loaded firmware, as it is the case for |
| 83 | Belkin F5D6050. |
| 84 | |
| 85 | Remove this check and assume the firmware to be working as long that the |
| 86 | external firmware download didn't fail and the firmware version could be |
| 87 | read at all. |
| 88 | |
| 89 | Reported by Corey Pappas <pappascd@gmail.com> |
| 90 | |
| 91 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 92 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 93 | |
| 94 | commit 7248e9b6e86a4e873388c5c0ecb1c19445600bce |
| 95 | Author: Pavel Roskin <proski@gnu.org> |
| 96 | Date: Sun Sep 30 14:40:47 2007 -0400 |
| 97 | |
| 98 | [PATCH] at76_usb: Revert to network device names starting with "wlan" |
| 99 | |
| 100 | The change to the default "eth" in 0.16 was unnecessary and broke some |
| 101 | setups. Reported by Mark Sansome <msansome@troodos.demon.co.uk> |
| 102 | |
| 103 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 104 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 105 | |
| 106 | commit c811300758190835c27f7ee892e559dcbe59a03e |
| 107 | Author: Pavel Roskin <proski@gnu.org> |
| 108 | Date: Sun Sep 30 14:40:40 2007 -0400 |
| 109 | |
| 110 | [PATCH] at76_usb: Add ID for Corega Wireless LAN USB-11 mini and mini2 |
| 111 | |
| 112 | Original patch by Weihua Yao <weihuayao@gmail.com> |
| 113 | |
| 114 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 115 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 116 | |
| 117 | commit 9d9f3d7aee3895ab7bf51ae4278899a5bb247bfe |
| 118 | Author: Pavel Roskin <proski@gnu.org> |
| 119 | Date: Sun Sep 30 14:40:34 2007 -0400 |
| 120 | |
| 121 | [PATCH] at76_usb: Avoid dealing with milliseconds when possible, use jiffies |
| 122 | |
| 123 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 124 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 125 | |
| 126 | commit 2364b6879b671d250e74fb05a773e45828c95f8b |
| 127 | Author: Pavel Roskin <proski@gnu.org> |
| 128 | Date: Sun Sep 30 14:40:27 2007 -0400 |
| 129 | |
| 130 | [PATCH] at76_usb: Move some parts from at76_usb.h to at76_usb.c |
| 131 | |
| 132 | Don't include anything from at76_usb.h. Keep DRIVER_NAME and |
| 133 | DRIVER_VERSION together. Define at76_dbg() after DRIVER_NAME. |
| 134 | |
| 135 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 136 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 137 | |
| 138 | commit 7ccc1dca2781f79ba27a105249f12b5616ee536d |
| 139 | Author: Pavel Roskin <proski@gnu.org> |
| 140 | Date: Sun Sep 30 14:40:21 2007 -0400 |
| 141 | |
| 142 | [PATCH] at76_usb: Remove unneeded memset() calls |
| 143 | |
| 144 | Use kzalloc for bss table entries. priv is already zeroized, no need to |
| 145 | do it again. |
| 146 | |
| 147 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 148 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 149 | |
| 150 | commit 23554a4e27c9ef10690c1b6fb82f3d2efb64b905 |
| 151 | Author: Pavel Roskin <proski@gnu.org> |
| 152 | Date: Sun Sep 30 14:40:15 2007 -0400 |
| 153 | |
| 154 | [PATCH] at76_usb: Clean reserved tx area for mgmt frames like it's done for data |
| 155 | |
| 156 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 157 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 158 | |
| 159 | commit ba89da27c6fde14a7e74ae2ee40b17056a213115 |
| 160 | Author: Pavel Roskin <proski@gnu.org> |
| 161 | Date: Sun Sep 30 14:40:08 2007 -0400 |
| 162 | |
| 163 | [PATCH] at76_usb: Make it clear that management frames are sent at 1Mbps |
| 164 | |
| 165 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 166 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 167 | |
| 168 | commit 95003db91c724fcd3ca75409a0f16da7ae53e7bb |
| 169 | Author: Pavel Roskin <proski@gnu.org> |
| 170 | Date: Sun Sep 30 14:40:02 2007 -0400 |
| 171 | |
| 172 | [PATCH] at76_usb: Eliminate variables used only in at76_dbg() |
| 173 | |
| 174 | Make it possible to disable at76_dbg() at the compile time without |
| 175 | introducing any warnings. |
| 176 | |
| 177 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 178 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 179 | |
| 180 | commit d45761f5556737b3f83ca51ef28315814a2eb0da |
| 181 | Author: Pavel Roskin <proski@gnu.org> |
| 182 | Date: Sun Sep 30 14:39:55 2007 -0400 |
| 183 | |
| 184 | [PATCH] at76_usb: Use string precision to avoid line termination |
| 185 | |
| 186 | In particular, don't extend ESSID to 33 bytes. |
| 187 | |
| 188 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 189 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 190 | |
| 191 | commit 1edd66829ef8d1baa7a156fe9239bcf07ca2c0a6 |
| 192 | Author: Pavel Roskin <proski@gnu.org> |
| 193 | Date: Sun Sep 30 14:39:49 2007 -0400 |
| 194 | |
| 195 | [PATCH] at76_usb: Stop worrying about line termination in ethtool info |
| 196 | |
| 197 | The driver's responsibility is not to overwrite the buffer and not to |
| 198 | leak kernel data. Line termination is the userspace responsibility. |
| 199 | |
| 200 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 201 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 202 | |
| 203 | commit 4c3ad2dc228dd0d86be552e8fa0e7dad0d5bdfe2 |
| 204 | Author: Pavel Roskin <proski@gnu.org> |
| 205 | Date: Sun Sep 30 14:39:42 2007 -0400 |
| 206 | |
| 207 | [PATCH] at76_usb: Rename tlv to ie for readability |
| 208 | |
| 209 | "ie" is the standard abbreviation for "information element". |
| 210 | |
| 211 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 212 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 213 | |
| 214 | commit 3667f0785f1d27edf28f6aaca1b5e4abe25db2eb |
| 215 | Author: Pavel Roskin <proski@gnu.org> |
| 216 | Date: Sun Sep 30 14:39:36 2007 -0400 |
| 217 | |
| 218 | [PATCH] at76_usb: Remove commented out code for multicast support |
| 219 | |
| 220 | If anyone cares to implement it, it should be started anew. |
| 221 | |
| 222 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 223 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 224 | |
| 225 | commit 6c6ab910bd49a987c726ef6bfb63be4bdd674b0f |
| 226 | Author: Pavel Roskin <proski@gnu.org> |
| 227 | Date: Sun Sep 30 14:39:30 2007 -0400 |
| 228 | |
| 229 | [PATCH] at76_usb: Eliminate err(), it's USB specific |
| 230 | |
| 231 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 232 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 233 | |
| 234 | commit 7ca1fbb860ab91d90415df9213f5ff205a119968 |
| 235 | Author: Pavel Roskin <proski@gnu.org> |
| 236 | Date: Sun Sep 30 14:39:23 2007 -0400 |
| 237 | |
| 238 | [PATCH] at76_usb: Integrate at76_set_monitor_mode() into at76_dwork_restart() |
| 239 | |
| 240 | Reorder some statements in at76_dwork_restart() |
| 241 | |
| 242 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 243 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 244 | |
| 245 | commit b5e08bb0c99675de557ef9f310f2e0fb8d5cc81a |
| 246 | Author: Pavel Roskin <proski@gnu.org> |
| 247 | Date: Sun Sep 30 14:39:17 2007 -0400 |
| 248 | |
| 249 | [PATCH] at76_usb: Fix turning radio off |
| 250 | |
| 251 | The Atmel's driver uses command 7 to turn radio off. Also, |
| 252 | CMD_GETOPMODE is bogus, remove it. |
| 253 | |
| 254 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 255 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 256 | |
| 257 | commit a50e255ad0b7ae2091f477fcf6750ce77a8248fb |
| 258 | Author: Pavel Roskin <proski@gnu.org> |
| 259 | Date: Sun Sep 30 14:39:11 2007 -0400 |
| 260 | |
| 261 | [PATCH] at76_usb: No need to reserve 72 bytes in set_mib_buffer - we only need 6 |
| 262 | |
| 263 | Use union for data in set_mib_buffer to guarantee minimally needed |
| 264 | buffer length. |
| 265 | |
| 266 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 267 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 268 | |
| 269 | commit 403974a3ef3076639a4edb74c04c24ca0b460180 |
| 270 | Author: Pavel Roskin <proski@gnu.org> |
| 271 | Date: Sun Sep 30 14:39:04 2007 -0400 |
| 272 | |
| 273 | [PATCH] at76_usb: Don't clean priv->mib_buf, just clean data explicitly if needed |
| 274 | |
| 275 | priv->mib_buf.reserved is 0 when priv is allocated, and stays 0. When |
| 276 | setting ibss_change, set data[0] to 0. |
| 277 | |
| 278 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 279 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 280 | |
| 281 | commit 90b86d1f90723ee1dcdf564766c0b3199afa2e74 |
| 282 | Author: Pavel Roskin <proski@gnu.org> |
| 283 | Date: Sun Sep 30 14:38:58 2007 -0400 |
| 284 | |
| 285 | [PATCH] at76_usb: Avoid dubious use of '\0' |
| 286 | |
| 287 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 288 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 289 | |
| 290 | commit ece33de2d302c114a54698607259d560459d39db |
| 291 | Author: Pavel Roskin <proski@gnu.org> |
| 292 | Date: Sun Sep 30 14:38:51 2007 -0400 |
| 293 | |
| 294 | [PATCH] at76_usb: Fix some device names in the device table |
| 295 | |
| 296 | Add vendor where it's missing. Use spelling preferred by the vendors. |
| 297 | |
| 298 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 299 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 300 | |
| 301 | commit 6ccc1309415700d10f79d3b888b1bb7ac29170c2 |
| 302 | Author: Pavel Roskin <proski@gnu.org> |
| 303 | Date: Sun Sep 30 14:38:45 2007 -0400 |
| 304 | |
| 305 | [PATCH] at76_usb: Use USB_DEVICE_DATA to improve readability of the device table |
| 306 | |
| 307 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 308 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 309 | |
| 310 | commit 9f2f9fa994ac1767bd27353c4bc151c39bf883df |
| 311 | Author: Pavel Roskin <proski@gnu.org> |
| 312 | Date: Sat Sep 1 00:37:34 2007 -0400 |
| 313 | |
| 314 | [PATCH] at76_usb: Replace scan_runs with scan_need_any |
| 315 | |
| 316 | It's more meaningful than a number. |
| 317 | |
| 318 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 319 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 320 | |
| 321 | commit 9f5e5be4d16b494a26fc3737fc97427b22e29ee1 |
| 322 | Author: Pavel Roskin <proski@gnu.org> |
| 323 | Date: Sat Sep 1 00:37:29 2007 -0400 |
| 324 | |
| 325 | [PATCH] at76_usb: Don't do additional MIB dumps if DEBUG is defined |
| 326 | |
| 327 | They are already printed from at76_startup_device(), which should be |
| 328 | enough. |
| 329 | |
| 330 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 331 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 332 | |
| 333 | commit dd623dbc6a58a32d8250219d6a771e55f1d926c8 |
| 334 | Author: Pavel Roskin <proski@gnu.org> |
| 335 | Date: Sat Sep 1 00:37:23 2007 -0400 |
| 336 | |
| 337 | [PATCH] at76_usb: Remove international roaming support |
| 338 | |
| 339 | It's broken beyond repair and legally dubious. |
| 340 | |
| 341 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 342 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 343 | |
| 344 | commit 1d5b838dd81ba67dc627a96d860baec0e36f584d |
| 345 | Author: Pavel Roskin <proski@gnu.org> |
| 346 | Date: Sat Sep 1 00:37:17 2007 -0400 |
| 347 | |
| 348 | [PATCH] at76_usb: Massive cleanup of dump functions |
| 349 | |
| 350 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 351 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 352 | |
| 353 | commit 7daaf8538f2b479f315a0ea1860fe099f01e6fa7 |
| 354 | Author: Pavel Roskin <proski@gnu.org> |
| 355 | Date: Sat Sep 1 00:37:11 2007 -0400 |
| 356 | |
| 357 | [PATCH] at76_usb: Simplify logic in at76_is_hidden_ssid() |
| 358 | |
| 359 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 360 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 361 | |
| 362 | commit d27f4b3b62a3486e09e184ce0b61ea4508f9aa8f |
| 363 | Author: Pavel Roskin <proski@gnu.org> |
| 364 | Date: Sat Sep 1 00:37:06 2007 -0400 |
| 365 | |
| 366 | [PATCH] at76_usb: Eliminate pr_debug() in favor of at76_dbg() |
| 367 | |
| 368 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 369 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 370 | |
| 371 | commit ecc3863b16c56824e25b2160453ceee8a508f853 |
| 372 | Author: Pavel Roskin <proski@gnu.org> |
| 373 | Date: Sat Sep 1 00:37:00 2007 -0400 |
| 374 | |
| 375 | [PATCH] at76_usb: Eliminate at76_dbg_dumpbuf() in favor of hex2str() |
| 376 | |
| 377 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 378 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 379 | |
| 380 | commit c77ad228fe687a7a8cd97ac828b74ad5786cf887 |
| 381 | Author: Pavel Roskin <proski@gnu.org> |
| 382 | Date: Sat Sep 1 00:36:54 2007 -0400 |
| 383 | |
| 384 | [PATCH] at76_usb: Convert dbg() to at76_dbg() or remove it |
| 385 | |
| 386 | Using two debug macros is inconsistent. Besides, dbg() only prints |
| 387 | something if DEBUG is defined. |
| 388 | |
| 389 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 390 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 391 | |
| 392 | commit 34f240d5c41c5b4dace0240c2cea6b14ec06f026 |
| 393 | Author: Pavel Roskin <proski@gnu.org> |
| 394 | Date: Sat Sep 1 00:36:49 2007 -0400 |
| 395 | |
| 396 | [PATCH] at76_usb: Remove unneeded braces, found by checkpatch.pl |
| 397 | |
| 398 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 399 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 400 | |
| 401 | commit 3c54047b4c1fcbeeec29fad99a89c94c51e6b794 |
| 402 | Author: Pavel Roskin <proski@gnu.org> |
| 403 | Date: Sat Sep 1 00:36:43 2007 -0400 |
| 404 | |
| 405 | [PATCH] at76_usb: Improve dump of MAC_ADDR |
| 406 | |
| 407 | Don't require DEBUG to be defined. Dump each group address separately, |
| 408 | next to the status. Rename MIB_MAC_ADD to MIB_MAC_ADDR. |
| 409 | |
| 410 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 411 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 412 | |
| 413 | commit b170e507588d3c4a53e6c64980f3e7ce2aec1d09 |
| 414 | Author: Pavel Roskin <proski@gnu.org> |
| 415 | Date: Sat Sep 1 00:36:37 2007 -0400 |
| 416 | |
| 417 | [PATCH] at76_usb: Don't dump mib_mdomain while scanning, it's done on device startup |
| 418 | |
| 419 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 420 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 421 | |
| 422 | commit 157ede19d732e5dfee841e0f118281e4b6790c58 |
| 423 | Author: Pavel Roskin <proski@gnu.org> |
| 424 | Date: Sat Sep 1 00:36:31 2007 -0400 |
| 425 | |
| 426 | [PATCH] at76_usb: Do implicit scanning only with current ESSID |
| 427 | |
| 428 | This should speed up association. We don't need non-matching APs if |
| 429 | ESSID is set. |
| 430 | |
| 431 | For user-requested scanning, scan for any essid after that. For |
| 432 | international scanning, start with scan_runs 1, as it was meant to be |
| 433 | done. Actually use ir_step 0 for international scanning. Adjust debug |
| 434 | messages correspondingly. |
| 435 | |
| 436 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 437 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 438 | |
| 439 | commit 9b1d8d0b33f9182bb052ee6e70a9b8a0aa3fa0f2 |
| 440 | Author: Pavel Roskin <proski@gnu.org> |
| 441 | Date: Sat Sep 1 00:36:26 2007 -0400 |
| 442 | |
| 443 | [PATCH] at76_usb: Simplify at76_get_mib_mdomain() |
| 444 | |
| 445 | The "error" label is not needed. |
| 446 | |
| 447 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 448 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 449 | |
| 450 | commit 855e36c680af75bae89164d1251f0529b51b602a |
| 451 | Author: Pavel Roskin <proski@gnu.org> |
| 452 | Date: Sat Sep 1 00:36:20 2007 -0400 |
| 453 | |
| 454 | [PATCH] at76_usb: Only retry resubmitting rx_urb once |
| 455 | |
| 456 | Other drivers don't even bother resubmitting it with GFP_KERNEL. If it |
| 457 | fails with GFP_KERNEL, we have a problem, and restarting the task is not |
| 458 | likely to be helpful. |
| 459 | |
| 460 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 461 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 462 | |
| 463 | commit b6ef8eca79defe0b34ac8ccb463c0e4b242581f1 |
| 464 | Author: Pavel Roskin <proski@gnu.org> |
| 465 | Date: Sat Sep 1 00:36:14 2007 -0400 |
| 466 | |
| 467 | [PATCH] at76_usb: Eliminate vendor IDs |
| 468 | |
| 469 | They are useless next to comments with full device names. |
| 470 | |
| 471 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 472 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 473 | |
| 474 | commit fc30a32862cfa8a4e66565c7831458d85b784059 |
| 475 | Author: Pavel Roskin <proski@gnu.org> |
| 476 | Date: Sat Sep 1 00:36:09 2007 -0400 |
| 477 | |
| 478 | [PATCH] at76_usb: Protect at76_iw_handler_set_scan() with mutex |
| 479 | |
| 480 | This prevents a race condition when a response from an AP comes before |
| 481 | we set state to MAC_SCANNING, but after at76_quiesce(). |
| 482 | |
| 483 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 484 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 485 | |
| 486 | commit 849bca5ecef33821a16a2aba06a9e711b03673d7 |
| 487 | Author: Pavel Roskin <proski@gnu.org> |
| 488 | Date: Sat Sep 1 00:36:03 2007 -0400 |
| 489 | |
| 490 | [PATCH] at76_usb: Improve output of the regdomain id |
| 491 | |
| 492 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 493 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 494 | |
| 495 | commit 25d0c50b09990a3f20ead4b84fe0db5f7d1a5ce0 |
| 496 | Author: Pavel Roskin <proski@gnu.org> |
| 497 | Date: Sat Sep 1 00:35:57 2007 -0400 |
| 498 | |
| 499 | [PATCH] at76_usb: Only cancel correct timeouts for Auth and Assoc replies |
| 500 | |
| 501 | Don't cancel all delayed works indiscriminately. In case of |
| 502 | at76_rx_mgmt_auth(), cancel the timeout regardless of the status of the |
| 503 | reply, as long as the reply is for us. |
| 504 | |
| 505 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 506 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 507 | |
| 508 | commit 93fea2be9c3a92e30f28aec53e5468090f11ca9c |
| 509 | Author: Pavel Roskin <proski@gnu.org> |
| 510 | Date: Sat Sep 1 00:35:52 2007 -0400 |
| 511 | |
| 512 | [PATCH] at76_usb: Start beacon timeout task when connected |
| 513 | |
| 514 | Limit beacon timeout task to the managed mode. Don't warn of the wrong |
| 515 | mode or state, just exit. |
| 516 | |
| 517 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 518 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 519 | |
| 520 | commit 9ea989b20c9aee36b2223fa6f98a98c63dd7df11 |
| 521 | Author: Pavel Roskin <proski@gnu.org> |
| 522 | Date: Sat Sep 1 00:35:46 2007 -0400 |
| 523 | |
| 524 | [PATCH] at76_usb: Don't disable and enable tasklets, it doesn't work as expected |
| 525 | |
| 526 | Bringing the interface down causes high CPU utilization. Correct fix |
| 527 | should probably disable rx URB, not only the rx tasklet. |
| 528 | |
| 529 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 530 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 531 | |
| 532 | commit ac42233d0e3cd7bd3434f2a07d8941e3daae2c6b |
| 533 | Author: Pavel Roskin <proski@gnu.org> |
| 534 | Date: Sat Sep 1 00:35:40 2007 -0400 |
| 535 | |
| 536 | [PATCH] at76_usb: Introduce at76_quiesce(), use it to stop network activity |
| 537 | |
| 538 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 539 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 540 | |
| 541 | commit ebb0c0e6310291517b87e2d20f2bf4f9990de4b5 |
| 542 | Author: Pavel Roskin <proski@gnu.org> |
| 543 | Date: Sat Sep 1 00:35:34 2007 -0400 |
| 544 | |
| 545 | [PATCH] at76_usb: Fix incorrect queue management in at76_tx_mgmt() |
| 546 | |
| 547 | The old pending buffer should be freed, not the new one. No need to set |
| 548 | txbuf to NULL. |
| 549 | |
| 550 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 551 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 552 | |
| 553 | commit 18e9c45377a017c8bd9db092596c43afaac08a4e |
| 554 | Author: Pavel Roskin <proski@gnu.org> |
| 555 | Date: Sat Sep 1 00:35:29 2007 -0400 |
| 556 | |
| 557 | [PATCH] at76_usb: Rename some long functions and fields |
| 558 | |
| 559 | Mostly try to avoid "bulk", which is a minor technical detail. Also |
| 560 | avoid read/write in favor of more common rx/tx. |
| 561 | |
| 562 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 563 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 564 | |
| 565 | commit 8a26847f9223046b95efb4dd60b4916e52d80a27 |
| 566 | Author: Pavel Roskin <proski@gnu.org> |
| 567 | Date: Sat Sep 1 00:35:23 2007 -0400 |
| 568 | |
| 569 | [PATCH] at76_usb: Fix hex2str() and mac2str() to avoid buffer overlap |
| 570 | |
| 571 | Declarations for two-dimensional arrays were written backwards. |
| 572 | |
| 573 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 574 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 575 | |
| 576 | commit 5a9a14c10d294f9b8338425918291f31a6176ee8 |
| 577 | Author: Pavel Roskin <proski@gnu.org> |
| 578 | Date: Sat Sep 1 00:35:17 2007 -0400 |
| 579 | |
| 580 | [PATCH] at76_usb: Simplify logic in at76_get_reg_domain() |
| 581 | |
| 582 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 583 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 584 | |
| 585 | commit 240f936685cec822f6a0c9f0dec29343c378f94c |
| 586 | Author: Pavel Roskin <proski@gnu.org> |
| 587 | Date: Sat Sep 1 00:35:11 2007 -0400 |
| 588 | |
| 589 | [PATCH] at76_usb: Add minimal support to 505AMX |
| 590 | |
| 591 | Use inline functions for board classification. Drop "_2958" from |
| 592 | BOARD_505A_2958, it's implied. |
| 593 | |
| 594 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 595 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 596 | |
| 597 | commit 74942a136c0e5948448cfc933e6f11eaf4a28ec1 |
| 598 | Author: Pavel Roskin <proski@gnu.org> |
| 599 | Date: Sat Sep 1 00:35:06 2007 -0400 |
| 600 | |
| 601 | [PATCH] at76_usb: Simplify at76_usbdfu_download() |
| 602 | |
| 603 | Make it look similar to at76_load_external_fw() |
| 604 | |
| 605 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 606 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 607 | |
| 608 | commit 1362544a8a960b1cbc72baa5ca0ed72bdff69151 |
| 609 | Author: Pavel Roskin <proski@gnu.org> |
| 610 | Date: Sat Sep 1 00:35:00 2007 -0400 |
| 611 | |
| 612 | [PATCH] at76_usb: Merge at76_download_external_fw() into at76_load_external_fw() |
| 613 | |
| 614 | Simplify logic to ensure that the last block is empty. Unify |
| 615 | DFU_PACKETSIZE and EXT_FW_BLOCK_SIZE into FW_BLOCK_SIZE. |
| 616 | |
| 617 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 618 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 619 | |
| 620 | commit 8a97f47646414035c5e939e335266531cb7ccf17 |
| 621 | Author: Pavel Roskin <proski@gnu.org> |
| 622 | Date: Sat Sep 1 00:34:54 2007 -0400 |
| 623 | |
| 624 | [PATCH] at76_usb: Don't use shift on numeric constants in usb_control_msg() arguments |
| 625 | |
| 626 | We don't know the meaning of 0x0a02 and 0x0902 in at76_get_hw_cfg() and |
| 627 | at76_get_hw_cfg_intersil() respectively, so don't pretend that we do. |
| 628 | |
| 629 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 630 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 631 | |
| 632 | commit 31f31b7906c86707ca296e23b8f26cd2ff918bd2 |
| 633 | Author: Pavel Roskin <proski@gnu.org> |
| 634 | Date: Sat Sep 1 00:34:49 2007 -0400 |
| 635 | |
| 636 | [PATCH] at76_usb: Move (de)initialization functions closer to the end of file |
| 637 | |
| 638 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 639 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 640 | |
| 641 | commit 3c1c1b75b79dc97522b6cee4290d49f00cd7ae20 |
| 642 | Author: Pavel Roskin <proski@gnu.org> |
| 643 | Date: Sat Sep 1 00:34:43 2007 -0400 |
| 644 | |
| 645 | [PATCH] at76_usb: Add myself to the author list |
| 646 | |
| 647 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 648 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 649 | |
| 650 | commit a89c328a9dcc9985eaca48aa85399db83d3848c9 |
| 651 | Author: Pavel Roskin <proski@gnu.org> |
| 652 | Date: Sat Sep 1 00:34:37 2007 -0400 |
| 653 | |
| 654 | [PATCH] at76_usb: Avoid overuse of NULL |
| 655 | |
| 656 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 657 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 658 | |
| 659 | commit 96f4aca7d406e878f378bd84a6bd32a4d02569f5 |
| 660 | Author: Pavel Roskin <proski@gnu.org> |
| 661 | Date: Sat Sep 1 00:34:31 2007 -0400 |
| 662 | |
| 663 | [PATCH] at76_usb: Rewrite at76_alloc_urbs() in a more linear fashion |
| 664 | |
| 665 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 666 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 667 | |
| 668 | commit 551fe4634ebf8bd5ad314b048ab65f69f4f237e5 |
| 669 | Author: Pavel Roskin <proski@gnu.org> |
| 670 | Date: Sat Sep 1 00:34:26 2007 -0400 |
| 671 | |
| 672 | [PATCH] at76_usb: Use existing macros to find bulk in and bulk out endpoints |
| 673 | |
| 674 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 675 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 676 | |
| 677 | commit c77dd96fc4ecc8455fb3b329b0b38cbe5bd16719 |
| 678 | Author: Pavel Roskin <proski@gnu.org> |
| 679 | Date: Sat Sep 1 00:34:20 2007 -0400 |
| 680 | |
| 681 | [PATCH] at76_usb: Protect at76_get_op_mode() and at76_get_mib() against short reads |
| 682 | |
| 683 | Don't rely on usb_control_msg() returning -EPIPE in absence of working |
| 684 | firmware. In some cases, no error is returned, but no data is read. |
| 685 | |
| 686 | Interpret short reads as an error, return -EIO. |
| 687 | |
| 688 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 689 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 690 | |
| 691 | commit a73c05ab296bec1e760a8a20916c2c3e331d7a2f |
| 692 | Author: Pavel Roskin <proski@gnu.org> |
| 693 | Date: Thu Aug 23 14:40:17 2007 -0400 |
| 694 | |
| 695 | [PATCH] Add at76_usb driver |
| 696 | |
| 697 | This driver supports USB devices using Atmel at76c503, at76c505 and |
| 698 | at76c505a chipsets. Known devices with this chip are Belkin F5D6050, |
| 699 | Dynalink/Askey WLL013, Linksys WUSB11 v2.6, Netgear MA101B and many |
| 700 | more. |
| 701 | |
| 702 | All supported devices require firmware, which can be downloaded from |
| 703 | http://developer.berlios.de/projects/at76c503a/ |
| 704 | |
| 705 | Signed-off-by: Pavel Roskin <proski@gnu.org> |
| 706 | Signed-off-by: John W. Linville <linville@tuxdriver.com> |
| 707 | |
| 708 | diff -up /dev/null linux-2.6.26.noarch/drivers/net/wireless/at76_usb.c |
| 709 | --- /dev/null 2008-08-01 08:46:19.471002774 -0400 |
| 710 | +++ linux-2.6.26.noarch/drivers/net/wireless/at76_usb.c 2008-08-01 11:33:05.000000000 -0400 |
| 711 | @@ -0,0 +1,5559 @@ |
| 712 | +/* |
| 713 | + * at76c503/at76c505 USB driver |
| 714 | + * |
| 715 | + * Copyright (c) 2002 - 2003 Oliver Kurth |
| 716 | + * Copyright (c) 2004 Joerg Albert <joerg.albert@gmx.de> |
| 717 | + * Copyright (c) 2004 Nick Jones |
| 718 | + * Copyright (c) 2004 Balint Seeber <n0_5p4m_p13453@hotmail.com> |
| 719 | + * Copyright (c) 2007 Guido Guenther <agx@sigxcpu.org> |
| 720 | + * |
| 721 | + * This program is free software; you can redistribute it and/or |
| 722 | + * modify it under the terms of the GNU General Public License as |
| 723 | + * published by the Free Software Foundation; either version 2 of |
| 724 | + * the License, or (at your option) any later version. |
| 725 | + * |
| 726 | + * This file is part of the Berlios driver for WLAN USB devices based on the |
| 727 | + * Atmel AT76C503A/505/505A. |
| 728 | + * |
| 729 | + * Some iw_handler code was taken from airo.c, (C) 1999 Benjamin Reed |
| 730 | + */ |
| 731 | + |
| 732 | +#include <linux/init.h> |
| 733 | +#include <linux/kernel.h> |
| 734 | +#include <linux/sched.h> |
| 735 | +#include <linux/errno.h> |
| 736 | +#include <linux/slab.h> |
| 737 | +#include <linux/module.h> |
| 738 | +#include <linux/spinlock.h> |
| 739 | +#include <linux/list.h> |
| 740 | +#include <linux/usb.h> |
| 741 | +#include <linux/netdevice.h> |
| 742 | +#include <linux/if_arp.h> |
| 743 | +#include <linux/etherdevice.h> |
| 744 | +#include <linux/ethtool.h> |
| 745 | +#include <linux/wireless.h> |
| 746 | +#include <net/iw_handler.h> |
| 747 | +#include <net/ieee80211_radiotap.h> |
| 748 | +#include <linux/firmware.h> |
| 749 | +#include <linux/leds.h> |
| 750 | +#include <net/ieee80211.h> |
| 751 | + |
| 752 | +#include "at76_usb.h" |
| 753 | + |
| 754 | +/* Version information */ |
| 755 | +#define DRIVER_NAME "at76_usb" |
| 756 | +#define DRIVER_VERSION "0.17" |
| 757 | +#define DRIVER_DESC "Atmel at76x USB Wireless LAN Driver" |
| 758 | + |
| 759 | +/* at76_debug bits */ |
| 760 | +#define DBG_PROGRESS 0x00000001 /* authentication/accociation */ |
| 761 | +#define DBG_BSS_TABLE 0x00000002 /* show BSS table after scans */ |
| 762 | +#define DBG_IOCTL 0x00000004 /* ioctl calls / settings */ |
| 763 | +#define DBG_MAC_STATE 0x00000008 /* MAC state transitions */ |
| 764 | +#define DBG_TX_DATA 0x00000010 /* tx header */ |
| 765 | +#define DBG_TX_DATA_CONTENT 0x00000020 /* tx content */ |
| 766 | +#define DBG_TX_MGMT 0x00000040 /* tx management */ |
| 767 | +#define DBG_RX_DATA 0x00000080 /* rx data header */ |
| 768 | +#define DBG_RX_DATA_CONTENT 0x00000100 /* rx data content */ |
| 769 | +#define DBG_RX_MGMT 0x00000200 /* rx mgmt frame headers */ |
| 770 | +#define DBG_RX_BEACON 0x00000400 /* rx beacon */ |
| 771 | +#define DBG_RX_CTRL 0x00000800 /* rx control */ |
| 772 | +#define DBG_RX_MGMT_CONTENT 0x00001000 /* rx mgmt content */ |
| 773 | +#define DBG_RX_FRAGS 0x00002000 /* rx data fragment handling */ |
| 774 | +#define DBG_DEVSTART 0x00004000 /* fw download, device start */ |
| 775 | +#define DBG_URB 0x00008000 /* rx urb status, ... */ |
| 776 | +#define DBG_RX_ATMEL_HDR 0x00010000 /* Atmel-specific Rx headers */ |
| 777 | +#define DBG_PROC_ENTRY 0x00020000 /* procedure entries/exits */ |
| 778 | +#define DBG_PM 0x00040000 /* power management settings */ |
| 779 | +#define DBG_BSS_MATCH 0x00080000 /* BSS match failures */ |
| 780 | +#define DBG_PARAMS 0x00100000 /* show configured parameters */ |
| 781 | +#define DBG_WAIT_COMPLETE 0x00200000 /* command completion */ |
| 782 | +#define DBG_RX_FRAGS_SKB 0x00400000 /* skb header of Rx fragments */ |
| 783 | +#define DBG_BSS_TABLE_RM 0x00800000 /* purging bss table entries */ |
| 784 | +#define DBG_MONITOR_MODE 0x01000000 /* monitor mode */ |
| 785 | +#define DBG_MIB 0x02000000 /* dump all MIBs on startup */ |
| 786 | +#define DBG_MGMT_TIMER 0x04000000 /* dump mgmt_timer ops */ |
| 787 | +#define DBG_WE_EVENTS 0x08000000 /* dump wireless events */ |
| 788 | +#define DBG_FW 0x10000000 /* firmware download */ |
| 789 | +#define DBG_DFU 0x20000000 /* device firmware upgrade */ |
| 790 | + |
| 791 | +#define DBG_DEFAULTS 0 |
| 792 | + |
| 793 | +/* Use our own dbg macro */ |
| 794 | +#define at76_dbg(bits, format, arg...) \ |
| 795 | + do { \ |
| 796 | + if (at76_debug & (bits)) \ |
| 797 | + printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \ |
| 798 | + } while (0) |
| 799 | + |
| 800 | +static int at76_debug = DBG_DEFAULTS; |
| 801 | + |
| 802 | +/* Protect against concurrent firmware loading and parsing */ |
| 803 | +static struct mutex fw_mutex; |
| 804 | + |
| 805 | +static struct fwentry firmwares[] = { |
| 806 | + [0] = {""}, |
| 807 | + [BOARD_503_ISL3861] = {"atmel_at76c503-i3861.bin"}, |
| 808 | + [BOARD_503_ISL3863] = {"atmel_at76c503-i3863.bin"}, |
| 809 | + [BOARD_503] = {"atmel_at76c503-rfmd.bin"}, |
| 810 | + [BOARD_503_ACC] = {"atmel_at76c503-rfmd-acc.bin"}, |
| 811 | + [BOARD_505] = {"atmel_at76c505-rfmd.bin"}, |
| 812 | + [BOARD_505_2958] = {"atmel_at76c505-rfmd2958.bin"}, |
| 813 | + [BOARD_505A] = {"atmel_at76c505a-rfmd2958.bin"}, |
| 814 | + [BOARD_505AMX] = {"atmel_at76c505amx-rfmd.bin"}, |
| 815 | +}; |
| 816 | + |
| 817 | +#define USB_DEVICE_DATA(__ops) .driver_info = (kernel_ulong_t)(__ops) |
| 818 | + |
| 819 | +static struct usb_device_id dev_table[] = { |
| 820 | + /* |
| 821 | + * at76c503-i3861 |
| 822 | + */ |
| 823 | + /* Generic AT76C503/3861 device */ |
| 824 | + {USB_DEVICE(0x03eb, 0x7603), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 825 | + /* Linksys WUSB11 v2.1/v2.6 */ |
| 826 | + {USB_DEVICE(0x066b, 0x2211), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 827 | + /* Netgear MA101 rev. A */ |
| 828 | + {USB_DEVICE(0x0864, 0x4100), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 829 | + /* Tekram U300C / Allnet ALL0193 */ |
| 830 | + {USB_DEVICE(0x0b3b, 0x1612), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 831 | + /* HP HN210W J7801A */ |
| 832 | + {USB_DEVICE(0x03f0, 0x011c), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 833 | + /* Sitecom/Z-Com/Zyxel M4Y-750 */ |
| 834 | + {USB_DEVICE(0x0cde, 0x0001), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 835 | + /* Dynalink/Askey WLL013 (intersil) */ |
| 836 | + {USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 837 | + /* EZ connect 11Mpbs Wireless USB Adapter SMC2662W v1 */ |
| 838 | + {USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 839 | + /* BenQ AWL300 */ |
| 840 | + {USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 841 | + /* Addtron AWU-120, Compex WLU11 */ |
| 842 | + {USB_DEVICE(0x05dd, 0xff31), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 843 | + /* Intel AP310 AnyPoint II USB */ |
| 844 | + {USB_DEVICE(0x8086, 0x0200), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 845 | + /* Dynalink L11U */ |
| 846 | + {USB_DEVICE(0x0d8e, 0x7100), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 847 | + /* Arescom WL-210, FCC id 07J-GL2411USB */ |
| 848 | + {USB_DEVICE(0x0d8e, 0x7110), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 849 | + /* I-O DATA WN-B11/USB */ |
| 850 | + {USB_DEVICE(0x04bb, 0x0919), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 851 | + /* BT Voyager 1010 */ |
| 852 | + {USB_DEVICE(0x069a, 0x0821), USB_DEVICE_DATA(BOARD_503_ISL3861)}, |
| 853 | + /* |
| 854 | + * at76c503-i3863 |
| 855 | + */ |
| 856 | + /* Generic AT76C503/3863 device */ |
| 857 | + {USB_DEVICE(0x03eb, 0x7604), USB_DEVICE_DATA(BOARD_503_ISL3863)}, |
| 858 | + /* Samsung SWL-2100U */ |
| 859 | + {USB_DEVICE(0x055d, 0xa000), USB_DEVICE_DATA(BOARD_503_ISL3863)}, |
| 860 | + /* |
| 861 | + * at76c503-rfmd |
| 862 | + */ |
| 863 | + /* Generic AT76C503/RFMD device */ |
| 864 | + {USB_DEVICE(0x03eb, 0x7605), USB_DEVICE_DATA(BOARD_503)}, |
| 865 | + /* Dynalink/Askey WLL013 (rfmd) */ |
| 866 | + {USB_DEVICE(0x069a, 0x0321), USB_DEVICE_DATA(BOARD_503)}, |
| 867 | + /* Linksys WUSB11 v2.6 */ |
| 868 | + {USB_DEVICE(0x077b, 0x2219), USB_DEVICE_DATA(BOARD_503)}, |
| 869 | + /* Network Everywhere NWU11B */ |
| 870 | + {USB_DEVICE(0x077b, 0x2227), USB_DEVICE_DATA(BOARD_503)}, |
| 871 | + /* Netgear MA101 rev. B */ |
| 872 | + {USB_DEVICE(0x0864, 0x4102), USB_DEVICE_DATA(BOARD_503)}, |
| 873 | + /* D-Link DWL-120 rev. E */ |
| 874 | + {USB_DEVICE(0x2001, 0x3200), USB_DEVICE_DATA(BOARD_503)}, |
| 875 | + /* Actiontec 802UAT1, HWU01150-01UK */ |
| 876 | + {USB_DEVICE(0x1668, 0x7605), USB_DEVICE_DATA(BOARD_503)}, |
| 877 | + /* AirVast W-Buddie WN210 */ |
| 878 | + {USB_DEVICE(0x03eb, 0x4102), USB_DEVICE_DATA(BOARD_503)}, |
| 879 | + /* Dick Smith Electronics XH1153 802.11b USB adapter */ |
| 880 | + {USB_DEVICE(0x1371, 0x5743), USB_DEVICE_DATA(BOARD_503)}, |
| 881 | + /* CNet CNUSB611 */ |
| 882 | + {USB_DEVICE(0x1371, 0x0001), USB_DEVICE_DATA(BOARD_503)}, |
| 883 | + /* FiberLine FL-WL200U */ |
| 884 | + {USB_DEVICE(0x1371, 0x0002), USB_DEVICE_DATA(BOARD_503)}, |
| 885 | + /* BenQ AWL400 USB stick */ |
| 886 | + {USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503)}, |
| 887 | + /* 3Com 3CRSHEW696 */ |
| 888 | + {USB_DEVICE(0x0506, 0x0a01), USB_DEVICE_DATA(BOARD_503)}, |
| 889 | + /* Siemens Santis ADSL WLAN USB adapter WLL 013 */ |
| 890 | + {USB_DEVICE(0x0681, 0x001b), USB_DEVICE_DATA(BOARD_503)}, |
| 891 | + /* Belkin F5D6050, version 2 */ |
| 892 | + {USB_DEVICE(0x050d, 0x0050), USB_DEVICE_DATA(BOARD_503)}, |
| 893 | + /* iBlitzz, BWU613 (not *B or *SB) */ |
| 894 | + {USB_DEVICE(0x07b8, 0xb000), USB_DEVICE_DATA(BOARD_503)}, |
| 895 | + /* Gigabyte GN-WLBM101 */ |
| 896 | + {USB_DEVICE(0x1044, 0x8003), USB_DEVICE_DATA(BOARD_503)}, |
| 897 | + /* Planex GW-US11S */ |
| 898 | + {USB_DEVICE(0x2019, 0x3220), USB_DEVICE_DATA(BOARD_503)}, |
| 899 | + /* Internal WLAN adapter in h5[4,5]xx series iPAQs */ |
| 900 | + {USB_DEVICE(0x049f, 0x0032), USB_DEVICE_DATA(BOARD_503)}, |
| 901 | + /* Corega Wireless LAN USB-11 mini */ |
| 902 | + {USB_DEVICE(0x07aa, 0x0011), USB_DEVICE_DATA(BOARD_503)}, |
| 903 | + /* Corega Wireless LAN USB-11 mini2 */ |
| 904 | + {USB_DEVICE(0x07aa, 0x0018), USB_DEVICE_DATA(BOARD_503)}, |
| 905 | + /* Uniden PCW100 */ |
| 906 | + {USB_DEVICE(0x05dd, 0xff35), USB_DEVICE_DATA(BOARD_503)}, |
| 907 | + /* |
| 908 | + * at76c503-rfmd-acc |
| 909 | + */ |
| 910 | + /* SMC2664W */ |
| 911 | + {USB_DEVICE(0x083a, 0x3501), USB_DEVICE_DATA(BOARD_503_ACC)}, |
| 912 | + /* Belkin F5D6050, SMC2662W v2, SMC2662W-AR */ |
| 913 | + {USB_DEVICE(0x0d5c, 0xa002), USB_DEVICE_DATA(BOARD_503_ACC)}, |
| 914 | + /* |
| 915 | + * at76c505-rfmd |
| 916 | + */ |
| 917 | + /* Generic AT76C505/RFMD */ |
| 918 | + {USB_DEVICE(0x03eb, 0x7606), USB_DEVICE_DATA(BOARD_505)}, |
| 919 | + /* |
| 920 | + * at76c505-rfmd2958 |
| 921 | + */ |
| 922 | + /* Generic AT76C505/RFMD, OvisLink WL-1130USB */ |
| 923 | + {USB_DEVICE(0x03eb, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)}, |
| 924 | + /* Fiberline FL-WL240U */ |
| 925 | + {USB_DEVICE(0x1371, 0x0014), USB_DEVICE_DATA(BOARD_505_2958)}, |
| 926 | + /* CNet CNUSB-611G */ |
| 927 | + {USB_DEVICE(0x1371, 0x0013), USB_DEVICE_DATA(BOARD_505_2958)}, |
| 928 | + /* Linksys WUSB11 v2.8 */ |
| 929 | + {USB_DEVICE(0x1915, 0x2233), USB_DEVICE_DATA(BOARD_505_2958)}, |
| 930 | + /* Xterasys XN-2122B, IBlitzz BWU613B/BWU613SB */ |
| 931 | + {USB_DEVICE(0x12fd, 0x1001), USB_DEVICE_DATA(BOARD_505_2958)}, |
| 932 | + /* Corega WLAN USB Stick 11 */ |
| 933 | + {USB_DEVICE(0x07aa, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)}, |
| 934 | + /* Microstar MSI Box MS6978 */ |
| 935 | + {USB_DEVICE(0x0db0, 0x1020), USB_DEVICE_DATA(BOARD_505_2958)}, |
| 936 | + /* |
| 937 | + * at76c505a-rfmd2958 |
| 938 | + */ |
| 939 | + /* Generic AT76C505A device */ |
| 940 | + {USB_DEVICE(0x03eb, 0x7614), USB_DEVICE_DATA(BOARD_505A)}, |
| 941 | + /* Generic AT76C505AS device */ |
| 942 | + {USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A)}, |
| 943 | + /* Siemens Gigaset USB WLAN Adapter 11 */ |
| 944 | + {USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A)}, |
| 945 | + /* |
| 946 | + * at76c505amx-rfmd |
| 947 | + */ |
| 948 | + /* Generic AT76C505AMX device */ |
| 949 | + {USB_DEVICE(0x03eb, 0x7615), USB_DEVICE_DATA(BOARD_505AMX)}, |
| 950 | + {} |
| 951 | +}; |
| 952 | + |
| 953 | +MODULE_DEVICE_TABLE(usb, dev_table); |
| 954 | + |
| 955 | +/* Supported rates of this hardware, bit 7 marks basic rates */ |
| 956 | +static const u8 hw_rates[] = { 0x82, 0x84, 0x0b, 0x16 }; |
| 957 | + |
| 958 | +/* Frequency of each channel in MHz */ |
| 959 | +static const long channel_frequency[] = { |
| 960 | + 2412, 2417, 2422, 2427, 2432, 2437, 2442, |
| 961 | + 2447, 2452, 2457, 2462, 2467, 2472, 2484 |
| 962 | +}; |
| 963 | + |
| 964 | +#define NUM_CHANNELS ARRAY_SIZE(channel_frequency) |
| 965 | + |
| 966 | +static const char *const preambles[] = { "long", "short", "auto" }; |
| 967 | + |
| 968 | +static const char *const mac_states[] = { |
| 969 | + [MAC_INIT] = "INIT", |
| 970 | + [MAC_SCANNING] = "SCANNING", |
| 971 | + [MAC_AUTH] = "AUTH", |
| 972 | + [MAC_ASSOC] = "ASSOC", |
| 973 | + [MAC_JOINING] = "JOINING", |
| 974 | + [MAC_CONNECTED] = "CONNECTED", |
| 975 | + [MAC_OWN_IBSS] = "OWN_IBSS" |
| 976 | +}; |
| 977 | + |
| 978 | +/* Firmware download */ |
| 979 | +/* DFU states */ |
| 980 | +#define STATE_IDLE 0x00 |
| 981 | +#define STATE_DETACH 0x01 |
| 982 | +#define STATE_DFU_IDLE 0x02 |
| 983 | +#define STATE_DFU_DOWNLOAD_SYNC 0x03 |
| 984 | +#define STATE_DFU_DOWNLOAD_BUSY 0x04 |
| 985 | +#define STATE_DFU_DOWNLOAD_IDLE 0x05 |
| 986 | +#define STATE_DFU_MANIFEST_SYNC 0x06 |
| 987 | +#define STATE_DFU_MANIFEST 0x07 |
| 988 | +#define STATE_DFU_MANIFEST_WAIT_RESET 0x08 |
| 989 | +#define STATE_DFU_UPLOAD_IDLE 0x09 |
| 990 | +#define STATE_DFU_ERROR 0x0a |
| 991 | + |
| 992 | +/* DFU commands */ |
| 993 | +#define DFU_DETACH 0 |
| 994 | +#define DFU_DNLOAD 1 |
| 995 | +#define DFU_UPLOAD 2 |
| 996 | +#define DFU_GETSTATUS 3 |
| 997 | +#define DFU_CLRSTATUS 4 |
| 998 | +#define DFU_GETSTATE 5 |
| 999 | +#define DFU_ABORT 6 |
| 1000 | + |
| 1001 | +#define FW_BLOCK_SIZE 1024 |
| 1002 | + |
| 1003 | +struct dfu_status { |
| 1004 | + unsigned char status; |
| 1005 | + unsigned char poll_timeout[3]; |
| 1006 | + unsigned char state; |
| 1007 | + unsigned char string; |
| 1008 | +} __attribute__((packed)); |
| 1009 | + |
| 1010 | +static inline int at76_is_intersil(enum board_type board) |
| 1011 | +{ |
| 1012 | + return (board == BOARD_503_ISL3861 || board == BOARD_503_ISL3863); |
| 1013 | +} |
| 1014 | + |
| 1015 | +static inline int at76_is_503rfmd(enum board_type board) |
| 1016 | +{ |
| 1017 | + return (board == BOARD_503 || board == BOARD_503_ACC); |
| 1018 | +} |
| 1019 | + |
| 1020 | +static inline int at76_is_505a(enum board_type board) |
| 1021 | +{ |
| 1022 | + return (board == BOARD_505A || board == BOARD_505AMX); |
| 1023 | +} |
| 1024 | + |
| 1025 | +/* Load a block of the first (internal) part of the firmware */ |
| 1026 | +static int at76_load_int_fw_block(struct usb_device *udev, int blockno, |
| 1027 | + void *block, int size) |
| 1028 | +{ |
| 1029 | + return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), DFU_DNLOAD, |
| 1030 | + USB_TYPE_CLASS | USB_DIR_OUT | |
| 1031 | + USB_RECIP_INTERFACE, blockno, 0, block, size, |
| 1032 | + USB_CTRL_GET_TIMEOUT); |
| 1033 | +} |
| 1034 | + |
| 1035 | +static int at76_dfu_get_status(struct usb_device *udev, |
| 1036 | + struct dfu_status *status) |
| 1037 | +{ |
| 1038 | + int ret; |
| 1039 | + |
| 1040 | + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), DFU_GETSTATUS, |
| 1041 | + USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, |
| 1042 | + 0, 0, status, sizeof(struct dfu_status), |
| 1043 | + USB_CTRL_GET_TIMEOUT); |
| 1044 | + return ret; |
| 1045 | +} |
| 1046 | + |
| 1047 | +static u8 at76_dfu_get_state(struct usb_device *udev, u8 *state) |
| 1048 | +{ |
| 1049 | + int ret; |
| 1050 | + |
| 1051 | + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), DFU_GETSTATE, |
| 1052 | + USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, |
| 1053 | + 0, 0, state, 1, USB_CTRL_GET_TIMEOUT); |
| 1054 | + return ret; |
| 1055 | +} |
| 1056 | + |
| 1057 | +/* Convert timeout from the DFU status to jiffies */ |
| 1058 | +static inline unsigned long at76_get_timeout(struct dfu_status *s) |
| 1059 | +{ |
| 1060 | + return msecs_to_jiffies((s->poll_timeout[2] << 16) |
| 1061 | + | (s->poll_timeout[1] << 8) |
| 1062 | + | (s->poll_timeout[0])); |
| 1063 | +} |
| 1064 | + |
| 1065 | +/* Load internal firmware from the buffer. If manifest_sync_timeout > 0, use |
| 1066 | + * its value in jiffies in the MANIFEST_SYNC state. */ |
| 1067 | +static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, |
| 1068 | + int manifest_sync_timeout) |
| 1069 | +{ |
| 1070 | + u8 *block; |
| 1071 | + struct dfu_status dfu_stat_buf; |
| 1072 | + int ret = 0; |
| 1073 | + int need_dfu_state = 1; |
| 1074 | + int is_done = 0; |
| 1075 | + u8 dfu_state = 0; |
| 1076 | + u32 dfu_timeout = 0; |
| 1077 | + int bsize = 0; |
| 1078 | + int blockno = 0; |
| 1079 | + |
| 1080 | + at76_dbg(DBG_DFU, "%s( %p, %u, %d)", __func__, buf, size, |
| 1081 | + manifest_sync_timeout); |
| 1082 | + |
| 1083 | + if (!size) { |
| 1084 | + dev_printk(KERN_ERR, &udev->dev, "FW buffer length invalid!\n"); |
| 1085 | + return -EINVAL; |
| 1086 | + } |
| 1087 | + |
| 1088 | + block = kmalloc(FW_BLOCK_SIZE, GFP_KERNEL); |
| 1089 | + if (!block) |
| 1090 | + return -ENOMEM; |
| 1091 | + |
| 1092 | + do { |
| 1093 | + if (need_dfu_state) { |
| 1094 | + ret = at76_dfu_get_state(udev, &dfu_state); |
| 1095 | + if (ret < 0) { |
| 1096 | + dev_printk(KERN_ERR, &udev->dev, |
| 1097 | + "cannot get DFU state: %d\n", ret); |
| 1098 | + goto exit; |
| 1099 | + } |
| 1100 | + need_dfu_state = 0; |
| 1101 | + } |
| 1102 | + |
| 1103 | + switch (dfu_state) { |
| 1104 | + case STATE_DFU_DOWNLOAD_SYNC: |
| 1105 | + at76_dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_SYNC"); |
| 1106 | + ret = at76_dfu_get_status(udev, &dfu_stat_buf); |
| 1107 | + if (ret >= 0) { |
| 1108 | + dfu_state = dfu_stat_buf.state; |
| 1109 | + dfu_timeout = at76_get_timeout(&dfu_stat_buf); |
| 1110 | + need_dfu_state = 0; |
| 1111 | + } else |
| 1112 | + dev_printk(KERN_ERR, &udev->dev, |
| 1113 | + "at76_dfu_get_status returned %d\n", |
| 1114 | + ret); |
| 1115 | + break; |
| 1116 | + |
| 1117 | + case STATE_DFU_DOWNLOAD_BUSY: |
| 1118 | + at76_dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_BUSY"); |
| 1119 | + need_dfu_state = 1; |
| 1120 | + |
| 1121 | + at76_dbg(DBG_DFU, "DFU: Resetting device"); |
| 1122 | + schedule_timeout_interruptible(dfu_timeout); |
| 1123 | + break; |
| 1124 | + |
| 1125 | + case STATE_DFU_DOWNLOAD_IDLE: |
| 1126 | + at76_dbg(DBG_DFU, "DOWNLOAD..."); |
| 1127 | + /* fall through */ |
| 1128 | + case STATE_DFU_IDLE: |
| 1129 | + at76_dbg(DBG_DFU, "DFU IDLE"); |
| 1130 | + |
| 1131 | + bsize = min_t(int, size, FW_BLOCK_SIZE); |
| 1132 | + memcpy(block, buf, bsize); |
| 1133 | + at76_dbg(DBG_DFU, "int fw, size left = %5d, " |
| 1134 | + "bsize = %4d, blockno = %2d", size, bsize, |
| 1135 | + blockno); |
| 1136 | + ret = |
| 1137 | + at76_load_int_fw_block(udev, blockno, block, bsize); |
| 1138 | + buf += bsize; |
| 1139 | + size -= bsize; |
| 1140 | + blockno++; |
| 1141 | + |
| 1142 | + if (ret != bsize) |
| 1143 | + dev_printk(KERN_ERR, &udev->dev, |
| 1144 | + "at76_load_int_fw_block " |
| 1145 | + "returned %d\n", ret); |
| 1146 | + need_dfu_state = 1; |
| 1147 | + break; |
| 1148 | + |
| 1149 | + case STATE_DFU_MANIFEST_SYNC: |
| 1150 | + at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST_SYNC"); |
| 1151 | + |
| 1152 | + ret = at76_dfu_get_status(udev, &dfu_stat_buf); |
| 1153 | + if (ret < 0) |
| 1154 | + break; |
| 1155 | + |
| 1156 | + dfu_state = dfu_stat_buf.state; |
| 1157 | + dfu_timeout = at76_get_timeout(&dfu_stat_buf); |
| 1158 | + need_dfu_state = 0; |
| 1159 | + |
| 1160 | + /* override the timeout from the status response, |
| 1161 | + needed for AT76C505A */ |
| 1162 | + if (manifest_sync_timeout > 0) |
| 1163 | + dfu_timeout = manifest_sync_timeout; |
| 1164 | + |
| 1165 | + at76_dbg(DBG_DFU, "DFU: Waiting for manifest phase"); |
| 1166 | + schedule_timeout_interruptible(dfu_timeout); |
| 1167 | + break; |
| 1168 | + |
| 1169 | + case STATE_DFU_MANIFEST: |
| 1170 | + at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST"); |
| 1171 | + is_done = 1; |
| 1172 | + break; |
| 1173 | + |
| 1174 | + case STATE_DFU_MANIFEST_WAIT_RESET: |
| 1175 | + at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST_WAIT_RESET"); |
| 1176 | + is_done = 1; |
| 1177 | + break; |
| 1178 | + |
| 1179 | + case STATE_DFU_UPLOAD_IDLE: |
| 1180 | + at76_dbg(DBG_DFU, "STATE_DFU_UPLOAD_IDLE"); |
| 1181 | + break; |
| 1182 | + |
| 1183 | + case STATE_DFU_ERROR: |
| 1184 | + at76_dbg(DBG_DFU, "STATE_DFU_ERROR"); |
| 1185 | + ret = -EPIPE; |
| 1186 | + break; |
| 1187 | + |
| 1188 | + default: |
| 1189 | + at76_dbg(DBG_DFU, "DFU UNKNOWN STATE (%d)", dfu_state); |
| 1190 | + ret = -EINVAL; |
| 1191 | + break; |
| 1192 | + } |
| 1193 | + } while (!is_done && (ret >= 0)); |
| 1194 | + |
| 1195 | +exit: |
| 1196 | + kfree(block); |
| 1197 | + if (ret >= 0) |
| 1198 | + ret = 0; |
| 1199 | + |
| 1200 | + return ret; |
| 1201 | +} |
| 1202 | + |
| 1203 | +/* Report that the scan results are ready */ |
| 1204 | +static inline void at76_iwevent_scan_complete(struct net_device *netdev) |
| 1205 | +{ |
| 1206 | + union iwreq_data wrqu; |
| 1207 | + wrqu.data.length = 0; |
| 1208 | + wrqu.data.flags = 0; |
| 1209 | + wireless_send_event(netdev, SIOCGIWSCAN, &wrqu, NULL); |
| 1210 | + at76_dbg(DBG_WE_EVENTS, "%s: SIOCGIWSCAN sent", netdev->name); |
| 1211 | +} |
| 1212 | + |
| 1213 | +static inline void at76_iwevent_bss_connect(struct net_device *netdev, |
| 1214 | + u8 *bssid) |
| 1215 | +{ |
| 1216 | + union iwreq_data wrqu; |
| 1217 | + wrqu.data.length = 0; |
| 1218 | + wrqu.data.flags = 0; |
| 1219 | + memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN); |
| 1220 | + wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1221 | + wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL); |
| 1222 | + at76_dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", netdev->name, |
| 1223 | + __func__); |
| 1224 | +} |
| 1225 | + |
| 1226 | +static inline void at76_iwevent_bss_disconnect(struct net_device *netdev) |
| 1227 | +{ |
| 1228 | + union iwreq_data wrqu; |
| 1229 | + wrqu.data.length = 0; |
| 1230 | + wrqu.data.flags = 0; |
| 1231 | + memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); |
| 1232 | + wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1233 | + wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL); |
| 1234 | + at76_dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", netdev->name, |
| 1235 | + __func__); |
| 1236 | +} |
| 1237 | + |
| 1238 | +#define HEX2STR_BUFFERS 4 |
| 1239 | +#define HEX2STR_MAX_LEN 64 |
| 1240 | +#define BIN2HEX(x) ((x) < 10 ? '0' + (x) : (x) + 'A' - 10) |
| 1241 | + |
| 1242 | +/* Convert binary data into hex string */ |
| 1243 | +static char *hex2str(void *buf, int len) |
| 1244 | +{ |
| 1245 | + static atomic_t a = ATOMIC_INIT(0); |
| 1246 | + static char bufs[HEX2STR_BUFFERS][3 * HEX2STR_MAX_LEN + 1]; |
| 1247 | + char *ret = bufs[atomic_inc_return(&a) & (HEX2STR_BUFFERS - 1)]; |
| 1248 | + char *obuf = ret; |
| 1249 | + u8 *ibuf = buf; |
| 1250 | + |
| 1251 | + if (len > HEX2STR_MAX_LEN) |
| 1252 | + len = HEX2STR_MAX_LEN; |
| 1253 | + |
| 1254 | + if (len <= 0) { |
| 1255 | + ret[0] = '\0'; |
| 1256 | + return ret; |
| 1257 | + } |
| 1258 | + |
| 1259 | + while (len--) { |
| 1260 | + *obuf++ = BIN2HEX(*ibuf >> 4); |
| 1261 | + *obuf++ = BIN2HEX(*ibuf & 0xf); |
| 1262 | + *obuf++ = '-'; |
| 1263 | + ibuf++; |
| 1264 | + } |
| 1265 | + *(--obuf) = '\0'; |
| 1266 | + |
| 1267 | + return ret; |
| 1268 | +} |
| 1269 | + |
| 1270 | +#define MAC2STR_BUFFERS 4 |
| 1271 | + |
| 1272 | +static inline char *mac2str(u8 *mac) |
| 1273 | +{ |
| 1274 | + static atomic_t a = ATOMIC_INIT(0); |
| 1275 | + static char bufs[MAC2STR_BUFFERS][6 * 3]; |
| 1276 | + char *str; |
| 1277 | + |
| 1278 | + str = bufs[atomic_inc_return(&a) & (MAC2STR_BUFFERS - 1)]; |
| 1279 | + sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x", |
| 1280 | + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); |
| 1281 | + return str; |
| 1282 | +} |
| 1283 | + |
| 1284 | +/* LED trigger */ |
| 1285 | +static int tx_activity; |
| 1286 | +static void at76_ledtrig_tx_timerfunc(unsigned long data); |
| 1287 | +static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0); |
| 1288 | +DEFINE_LED_TRIGGER(ledtrig_tx); |
| 1289 | + |
| 1290 | +static void at76_ledtrig_tx_timerfunc(unsigned long data) |
| 1291 | +{ |
| 1292 | + static int tx_lastactivity; |
| 1293 | + |
| 1294 | + if (tx_lastactivity != tx_activity) { |
| 1295 | + tx_lastactivity = tx_activity; |
| 1296 | + led_trigger_event(ledtrig_tx, LED_FULL); |
| 1297 | + mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4); |
| 1298 | + } else |
| 1299 | + led_trigger_event(ledtrig_tx, LED_OFF); |
| 1300 | +} |
| 1301 | + |
| 1302 | +static void at76_ledtrig_tx_activity(void) |
| 1303 | +{ |
| 1304 | + tx_activity++; |
| 1305 | + if (!timer_pending(&ledtrig_tx_timer)) |
| 1306 | + mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4); |
| 1307 | +} |
| 1308 | + |
| 1309 | +/* Check if the given ssid is hidden */ |
| 1310 | +static inline int at76_is_hidden_ssid(u8 *ssid, int length) |
| 1311 | +{ |
| 1312 | + static const u8 zeros[32]; |
| 1313 | + |
| 1314 | + if (length == 0) |
| 1315 | + return 1; |
| 1316 | + |
| 1317 | + if (length == 1 && ssid[0] == ' ') |
| 1318 | + return 1; |
| 1319 | + |
| 1320 | + return (memcmp(ssid, zeros, length) == 0); |
| 1321 | +} |
| 1322 | + |
| 1323 | +static inline void at76_free_bss_list(struct at76_priv *priv) |
| 1324 | +{ |
| 1325 | + struct list_head *next, *ptr; |
| 1326 | + unsigned long flags; |
| 1327 | + |
| 1328 | + spin_lock_irqsave(&priv->bss_list_spinlock, flags); |
| 1329 | + |
| 1330 | + priv->curr_bss = NULL; |
| 1331 | + |
| 1332 | + list_for_each_safe(ptr, next, &priv->bss_list) { |
| 1333 | + list_del(ptr); |
| 1334 | + kfree(list_entry(ptr, struct bss_info, list)); |
| 1335 | + } |
| 1336 | + |
| 1337 | + spin_unlock_irqrestore(&priv->bss_list_spinlock, flags); |
| 1338 | +} |
| 1339 | + |
| 1340 | +static int at76_remap(struct usb_device *udev) |
| 1341 | +{ |
| 1342 | + int ret; |
| 1343 | + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0a, |
| 1344 | + USB_TYPE_VENDOR | USB_DIR_OUT | |
| 1345 | + USB_RECIP_INTERFACE, 0, 0, NULL, 0, |
| 1346 | + USB_CTRL_GET_TIMEOUT); |
| 1347 | + if (ret < 0) |
| 1348 | + return ret; |
| 1349 | + return 0; |
| 1350 | +} |
| 1351 | + |
| 1352 | +static int at76_get_op_mode(struct usb_device *udev) |
| 1353 | +{ |
| 1354 | + int ret; |
| 1355 | + u8 op_mode; |
| 1356 | + |
| 1357 | + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, |
| 1358 | + USB_TYPE_VENDOR | USB_DIR_IN | |
| 1359 | + USB_RECIP_INTERFACE, 0x01, 0, &op_mode, 1, |
| 1360 | + USB_CTRL_GET_TIMEOUT); |
| 1361 | + if (ret < 0) |
| 1362 | + return ret; |
| 1363 | + else if (ret < 1) |
| 1364 | + return -EIO; |
| 1365 | + else |
| 1366 | + return op_mode; |
| 1367 | +} |
| 1368 | + |
| 1369 | +/* Load a block of the second ("external") part of the firmware */ |
| 1370 | +static inline int at76_load_ext_fw_block(struct usb_device *udev, int blockno, |
| 1371 | + void *block, int size) |
| 1372 | +{ |
| 1373 | + return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0e, |
| 1374 | + USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, |
| 1375 | + 0x0802, blockno, block, size, |
| 1376 | + USB_CTRL_GET_TIMEOUT); |
| 1377 | +} |
| 1378 | + |
| 1379 | +static inline int at76_get_hw_cfg(struct usb_device *udev, |
| 1380 | + union at76_hwcfg *buf, int buf_size) |
| 1381 | +{ |
| 1382 | + return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, |
| 1383 | + USB_TYPE_VENDOR | USB_DIR_IN | |
| 1384 | + USB_RECIP_INTERFACE, 0x0a02, 0, |
| 1385 | + buf, buf_size, USB_CTRL_GET_TIMEOUT); |
| 1386 | +} |
| 1387 | + |
| 1388 | +/* Intersil boards use a different "value" for GetHWConfig requests */ |
| 1389 | +static inline int at76_get_hw_cfg_intersil(struct usb_device *udev, |
| 1390 | + union at76_hwcfg *buf, int buf_size) |
| 1391 | +{ |
| 1392 | + return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, |
| 1393 | + USB_TYPE_VENDOR | USB_DIR_IN | |
| 1394 | + USB_RECIP_INTERFACE, 0x0902, 0, |
| 1395 | + buf, buf_size, USB_CTRL_GET_TIMEOUT); |
| 1396 | +} |
| 1397 | + |
| 1398 | +/* Get the hardware configuration for the adapter and put it to the appropriate |
| 1399 | + * fields of 'priv' (the GetHWConfig request and interpretation of the result |
| 1400 | + * depends on the board type) */ |
| 1401 | +static int at76_get_hw_config(struct at76_priv *priv) |
| 1402 | +{ |
| 1403 | + int ret; |
| 1404 | + union at76_hwcfg *hwcfg = kmalloc(sizeof(*hwcfg), GFP_KERNEL); |
| 1405 | + |
| 1406 | + if (!hwcfg) |
| 1407 | + return -ENOMEM; |
| 1408 | + |
| 1409 | + if (at76_is_intersil(priv->board_type)) { |
| 1410 | + ret = at76_get_hw_cfg_intersil(priv->udev, hwcfg, |
| 1411 | + sizeof(hwcfg->i)); |
| 1412 | + if (ret < 0) |
| 1413 | + goto exit; |
| 1414 | + memcpy(priv->mac_addr, hwcfg->i.mac_addr, ETH_ALEN); |
| 1415 | + priv->regulatory_domain = hwcfg->i.regulatory_domain; |
| 1416 | + } else if (at76_is_503rfmd(priv->board_type)) { |
| 1417 | + ret = at76_get_hw_cfg(priv->udev, hwcfg, sizeof(hwcfg->r3)); |
| 1418 | + if (ret < 0) |
| 1419 | + goto exit; |
| 1420 | + memcpy(priv->mac_addr, hwcfg->r3.mac_addr, ETH_ALEN); |
| 1421 | + priv->regulatory_domain = hwcfg->r3.regulatory_domain; |
| 1422 | + } else { |
| 1423 | + ret = at76_get_hw_cfg(priv->udev, hwcfg, sizeof(hwcfg->r5)); |
| 1424 | + if (ret < 0) |
| 1425 | + goto exit; |
| 1426 | + memcpy(priv->mac_addr, hwcfg->r5.mac_addr, ETH_ALEN); |
| 1427 | + priv->regulatory_domain = hwcfg->r5.regulatory_domain; |
| 1428 | + } |
| 1429 | + |
| 1430 | +exit: |
| 1431 | + kfree(hwcfg); |
| 1432 | + if (ret < 0) |
| 1433 | + printk(KERN_ERR "%s: cannot get HW Config (error %d)\n", |
| 1434 | + priv->netdev->name, ret); |
| 1435 | + |
| 1436 | + return ret; |
| 1437 | +} |
| 1438 | + |
| 1439 | +static struct reg_domain const *at76_get_reg_domain(u16 code) |
| 1440 | +{ |
| 1441 | + int i; |
| 1442 | + static struct reg_domain const fd_tab[] = { |
| 1443 | + {0x10, "FCC (USA)", 0x7ff}, /* ch 1-11 */ |
| 1444 | + {0x20, "IC (Canada)", 0x7ff}, /* ch 1-11 */ |
| 1445 | + {0x30, "ETSI (most of Europe)", 0x1fff}, /* ch 1-13 */ |
| 1446 | + {0x31, "Spain", 0x600}, /* ch 10-11 */ |
| 1447 | + {0x32, "France", 0x1e00}, /* ch 10-13 */ |
| 1448 | + {0x40, "MKK (Japan)", 0x2000}, /* ch 14 */ |
| 1449 | + {0x41, "MKK1 (Japan)", 0x3fff}, /* ch 1-14 */ |
| 1450 | + {0x50, "Israel", 0x3fc}, /* ch 3-9 */ |
| 1451 | + {0x00, "<unknown>", 0xffffffff} /* ch 1-32 */ |
| 1452 | + }; |
| 1453 | + |
| 1454 | + /* Last entry is fallback for unknown domain code */ |
| 1455 | + for (i = 0; i < ARRAY_SIZE(fd_tab) - 1; i++) |
| 1456 | + if (code == fd_tab[i].code) |
| 1457 | + break; |
| 1458 | + |
| 1459 | + return &fd_tab[i]; |
| 1460 | +} |
| 1461 | + |
| 1462 | +static inline int at76_get_mib(struct usb_device *udev, u16 mib, void *buf, |
| 1463 | + int buf_size) |
| 1464 | +{ |
| 1465 | + int ret; |
| 1466 | + |
| 1467 | + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, |
| 1468 | + USB_TYPE_VENDOR | USB_DIR_IN | |
| 1469 | + USB_RECIP_INTERFACE, mib << 8, 0, buf, buf_size, |
| 1470 | + USB_CTRL_GET_TIMEOUT); |
| 1471 | + if (ret >= 0 && ret != buf_size) |
| 1472 | + return -EIO; |
| 1473 | + return ret; |
| 1474 | +} |
| 1475 | + |
| 1476 | +/* Return positive number for status, negative for an error */ |
| 1477 | +static inline int at76_get_cmd_status(struct usb_device *udev, u8 cmd) |
| 1478 | +{ |
| 1479 | + u8 stat_buf[40]; |
| 1480 | + int ret; |
| 1481 | + |
| 1482 | + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x22, |
| 1483 | + USB_TYPE_VENDOR | USB_DIR_IN | |
| 1484 | + USB_RECIP_INTERFACE, cmd, 0, stat_buf, |
| 1485 | + sizeof(stat_buf), USB_CTRL_GET_TIMEOUT); |
| 1486 | + if (ret < 0) |
| 1487 | + return ret; |
| 1488 | + |
| 1489 | + return stat_buf[5]; |
| 1490 | +} |
| 1491 | + |
| 1492 | +static int at76_set_card_command(struct usb_device *udev, int cmd, void *buf, |
| 1493 | + int buf_size) |
| 1494 | +{ |
| 1495 | + int ret; |
| 1496 | + struct at76_command *cmd_buf = kmalloc(sizeof(struct at76_command) + |
| 1497 | + buf_size, GFP_KERNEL); |
| 1498 | + |
| 1499 | + if (!cmd_buf) |
| 1500 | + return -ENOMEM; |
| 1501 | + |
| 1502 | + cmd_buf->cmd = cmd; |
| 1503 | + cmd_buf->reserved = 0; |
| 1504 | + cmd_buf->size = cpu_to_le16(buf_size); |
| 1505 | + memcpy(cmd_buf->data, buf, buf_size); |
| 1506 | + |
| 1507 | + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0e, |
| 1508 | + USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, |
| 1509 | + 0, 0, cmd_buf, |
| 1510 | + sizeof(struct at76_command) + buf_size, |
| 1511 | + USB_CTRL_GET_TIMEOUT); |
| 1512 | + kfree(cmd_buf); |
| 1513 | + return ret; |
| 1514 | +} |
| 1515 | + |
| 1516 | +#define MAKE_CMD_STATUS_CASE(c) case (c): return #c |
| 1517 | +static const char *at76_get_cmd_status_string(u8 cmd_status) |
| 1518 | +{ |
| 1519 | + switch (cmd_status) { |
| 1520 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_IDLE); |
| 1521 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_COMPLETE); |
| 1522 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_UNKNOWN); |
| 1523 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_INVALID_PARAMETER); |
| 1524 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_FUNCTION_NOT_SUPPORTED); |
| 1525 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_TIME_OUT); |
| 1526 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_IN_PROGRESS); |
| 1527 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_HOST_FAILURE); |
| 1528 | + MAKE_CMD_STATUS_CASE(CMD_STATUS_SCAN_FAILED); |
| 1529 | + } |
| 1530 | + |
| 1531 | + return "UNKNOWN"; |
| 1532 | +} |
| 1533 | + |
| 1534 | +/* Wait until the command is completed */ |
| 1535 | +static int at76_wait_completion(struct at76_priv *priv, int cmd) |
| 1536 | +{ |
| 1537 | + int status = 0; |
| 1538 | + unsigned long timeout = jiffies + CMD_COMPLETION_TIMEOUT; |
| 1539 | + |
| 1540 | + do { |
| 1541 | + status = at76_get_cmd_status(priv->udev, cmd); |
| 1542 | + if (status < 0) { |
| 1543 | + printk(KERN_ERR "%s: at76_get_cmd_status failed: %d\n", |
| 1544 | + priv->netdev->name, status); |
| 1545 | + break; |
| 1546 | + } |
| 1547 | + |
| 1548 | + at76_dbg(DBG_WAIT_COMPLETE, |
| 1549 | + "%s: Waiting on cmd %d, status = %d (%s)", |
| 1550 | + priv->netdev->name, cmd, status, |
| 1551 | + at76_get_cmd_status_string(status)); |
| 1552 | + |
| 1553 | + if (status != CMD_STATUS_IN_PROGRESS |
| 1554 | + && status != CMD_STATUS_IDLE) |
| 1555 | + break; |
| 1556 | + |
| 1557 | + schedule_timeout_interruptible(HZ / 10); /* 100 ms */ |
| 1558 | + if (time_after(jiffies, timeout)) { |
| 1559 | + printk(KERN_ERR |
| 1560 | + "%s: completion timeout for command %d\n", |
| 1561 | + priv->netdev->name, cmd); |
| 1562 | + status = -ETIMEDOUT; |
| 1563 | + break; |
| 1564 | + } |
| 1565 | + } while (1); |
| 1566 | + |
| 1567 | + return status; |
| 1568 | +} |
| 1569 | + |
| 1570 | +static int at76_set_mib(struct at76_priv *priv, struct set_mib_buffer *buf) |
| 1571 | +{ |
| 1572 | + int ret; |
| 1573 | + |
| 1574 | + ret = at76_set_card_command(priv->udev, CMD_SET_MIB, buf, |
| 1575 | + offsetof(struct set_mib_buffer, |
| 1576 | + data) + buf->size); |
| 1577 | + if (ret < 0) |
| 1578 | + return ret; |
| 1579 | + |
| 1580 | + ret = at76_wait_completion(priv, CMD_SET_MIB); |
| 1581 | + if (ret != CMD_STATUS_COMPLETE) { |
| 1582 | + printk(KERN_INFO |
| 1583 | + "%s: set_mib: at76_wait_completion failed " |
| 1584 | + "with %d\n", priv->netdev->name, ret); |
| 1585 | + ret = -EIO; |
| 1586 | + } |
| 1587 | + |
| 1588 | + return ret; |
| 1589 | +} |
| 1590 | + |
| 1591 | +/* Return < 0 on error, == 0 if no command sent, == 1 if cmd sent */ |
| 1592 | +static int at76_set_radio(struct at76_priv *priv, int enable) |
| 1593 | +{ |
| 1594 | + int ret; |
| 1595 | + int cmd; |
| 1596 | + |
| 1597 | + if (priv->radio_on == enable) |
| 1598 | + return 0; |
| 1599 | + |
| 1600 | + cmd = enable ? CMD_RADIO_ON : CMD_RADIO_OFF; |
| 1601 | + |
| 1602 | + ret = at76_set_card_command(priv->udev, cmd, NULL, 0); |
| 1603 | + if (ret < 0) |
| 1604 | + printk(KERN_ERR "%s: at76_set_card_command(%d) failed: %d\n", |
| 1605 | + priv->netdev->name, cmd, ret); |
| 1606 | + else |
| 1607 | + ret = 1; |
| 1608 | + |
| 1609 | + priv->radio_on = enable; |
| 1610 | + return ret; |
| 1611 | +} |
| 1612 | + |
| 1613 | +/* Set current power save mode (AT76_PM_OFF/AT76_PM_ON/AT76_PM_SMART) */ |
| 1614 | +static int at76_set_pm_mode(struct at76_priv *priv) |
| 1615 | +{ |
| 1616 | + int ret = 0; |
| 1617 | + |
| 1618 | + priv->mib_buf.type = MIB_MAC_MGMT; |
| 1619 | + priv->mib_buf.size = 1; |
| 1620 | + priv->mib_buf.index = offsetof(struct mib_mac_mgmt, power_mgmt_mode); |
| 1621 | + priv->mib_buf.data.byte = priv->pm_mode; |
| 1622 | + |
| 1623 | + ret = at76_set_mib(priv, &priv->mib_buf); |
| 1624 | + if (ret < 0) |
| 1625 | + printk(KERN_ERR "%s: set_mib (pm_mode) failed: %d\n", |
| 1626 | + priv->netdev->name, ret); |
| 1627 | + |
| 1628 | + return ret; |
| 1629 | +} |
| 1630 | + |
| 1631 | +/* Set the association id for power save mode */ |
| 1632 | +static int at76_set_associd(struct at76_priv *priv, u16 id) |
| 1633 | +{ |
| 1634 | + int ret = 0; |
| 1635 | + |
| 1636 | + priv->mib_buf.type = MIB_MAC_MGMT; |
| 1637 | + priv->mib_buf.size = 2; |
| 1638 | + priv->mib_buf.index = offsetof(struct mib_mac_mgmt, station_id); |
| 1639 | + priv->mib_buf.data.word = cpu_to_le16(id); |
| 1640 | + |
| 1641 | + ret = at76_set_mib(priv, &priv->mib_buf); |
| 1642 | + if (ret < 0) |
| 1643 | + printk(KERN_ERR "%s: set_mib (associd) failed: %d\n", |
| 1644 | + priv->netdev->name, ret); |
| 1645 | + |
| 1646 | + return ret; |
| 1647 | +} |
| 1648 | + |
| 1649 | +/* Set the listen interval for power save mode */ |
| 1650 | +static int at76_set_listen_interval(struct at76_priv *priv, u16 interval) |
| 1651 | +{ |
| 1652 | + int ret = 0; |
| 1653 | + |
| 1654 | + priv->mib_buf.type = MIB_MAC; |
| 1655 | + priv->mib_buf.size = 2; |
| 1656 | + priv->mib_buf.index = offsetof(struct mib_mac, listen_interval); |
| 1657 | + priv->mib_buf.data.word = cpu_to_le16(interval); |
| 1658 | + |
| 1659 | + ret = at76_set_mib(priv, &priv->mib_buf); |
| 1660 | + if (ret < 0) |
| 1661 | + printk(KERN_ERR |
| 1662 | + "%s: set_mib (listen_interval) failed: %d\n", |
| 1663 | + priv->netdev->name, ret); |
| 1664 | + |
| 1665 | + return ret; |
| 1666 | +} |
| 1667 | + |
| 1668 | +static int at76_set_preamble(struct at76_priv *priv, u8 type) |
| 1669 | +{ |
| 1670 | + int ret = 0; |
| 1671 | + |
| 1672 | + priv->mib_buf.type = MIB_LOCAL; |
| 1673 | + priv->mib_buf.size = 1; |
| 1674 | + priv->mib_buf.index = offsetof(struct mib_local, preamble_type); |
| 1675 | + priv->mib_buf.data.byte = type; |
| 1676 | + |
| 1677 | + ret = at76_set_mib(priv, &priv->mib_buf); |
| 1678 | + if (ret < 0) |
| 1679 | + printk(KERN_ERR "%s: set_mib (preamble) failed: %d\n", |
| 1680 | + priv->netdev->name, ret); |
| 1681 | + |
| 1682 | + return ret; |
| 1683 | +} |
| 1684 | + |
| 1685 | +static int at76_set_frag(struct at76_priv *priv, u16 size) |
| 1686 | +{ |
| 1687 | + int ret = 0; |
| 1688 | + |
| 1689 | + priv->mib_buf.type = MIB_MAC; |
| 1690 | + priv->mib_buf.size = 2; |
| 1691 | + priv->mib_buf.index = offsetof(struct mib_mac, frag_threshold); |
| 1692 | + priv->mib_buf.data.word = cpu_to_le16(size); |
| 1693 | + |
| 1694 | + ret = at76_set_mib(priv, &priv->mib_buf); |
| 1695 | + if (ret < 0) |
| 1696 | + printk(KERN_ERR "%s: set_mib (frag threshold) failed: %d\n", |
| 1697 | + priv->netdev->name, ret); |
| 1698 | + |
| 1699 | + return ret; |
| 1700 | +} |
| 1701 | + |
| 1702 | +static int at76_set_rts(struct at76_priv *priv, u16 size) |
| 1703 | +{ |
| 1704 | + int ret = 0; |
| 1705 | + |
| 1706 | + priv->mib_buf.type = MIB_MAC; |
| 1707 | + priv->mib_buf.size = 2; |
| 1708 | + priv->mib_buf.index = offsetof(struct mib_mac, rts_threshold); |
| 1709 | + priv->mib_buf.data.word = cpu_to_le16(size); |
| 1710 | + |
| 1711 | + ret = at76_set_mib(priv, &priv->mib_buf); |
| 1712 | + if (ret < 0) |
| 1713 | + printk(KERN_ERR "%s: set_mib (rts) failed: %d\n", |
| 1714 | + priv->netdev->name, ret); |
| 1715 | + |
| 1716 | + return ret; |
| 1717 | +} |
| 1718 | + |
| 1719 | +static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff) |
| 1720 | +{ |
| 1721 | + int ret = 0; |
| 1722 | + |
| 1723 | + priv->mib_buf.type = MIB_LOCAL; |
| 1724 | + priv->mib_buf.size = 1; |
| 1725 | + priv->mib_buf.index = offsetof(struct mib_local, txautorate_fallback); |
| 1726 | + priv->mib_buf.data.byte = onoff; |
| 1727 | + |
| 1728 | + ret = at76_set_mib(priv, &priv->mib_buf); |
| 1729 | + if (ret < 0) |
| 1730 | + printk(KERN_ERR "%s: set_mib (autorate fallback) failed: %d\n", |
| 1731 | + priv->netdev->name, ret); |
| 1732 | + |
| 1733 | + return ret; |
| 1734 | +} |
| 1735 | + |
| 1736 | +static int at76_add_mac_address(struct at76_priv *priv, void *addr) |
| 1737 | +{ |
| 1738 | + int ret = 0; |
| 1739 | + |
| 1740 | + priv->mib_buf.type = MIB_MAC_ADDR; |
| 1741 | + priv->mib_buf.size = ETH_ALEN; |
| 1742 | + priv->mib_buf.index = offsetof(struct mib_mac_addr, mac_addr); |
| 1743 | + memcpy(priv->mib_buf.data.addr, addr, ETH_ALEN); |
| 1744 | + |
| 1745 | + ret = at76_set_mib(priv, &priv->mib_buf); |
| 1746 | + if (ret < 0) |
| 1747 | + printk(KERN_ERR "%s: set_mib (MAC_ADDR, mac_addr) failed: %d\n", |
| 1748 | + priv->netdev->name, ret); |
| 1749 | + |
| 1750 | + return ret; |
| 1751 | +} |
| 1752 | + |
| 1753 | +static void at76_dump_mib_mac_addr(struct at76_priv *priv) |
| 1754 | +{ |
| 1755 | + int i; |
| 1756 | + int ret; |
| 1757 | + struct mib_mac_addr *m = kmalloc(sizeof(struct mib_mac_addr), |
| 1758 | + GFP_KERNEL); |
| 1759 | + |
| 1760 | + if (!m) |
| 1761 | + return; |
| 1762 | + |
| 1763 | + ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m, |
| 1764 | + sizeof(struct mib_mac_addr)); |
| 1765 | + if (ret < 0) { |
| 1766 | + printk(KERN_ERR "%s: at76_get_mib (MAC_ADDR) failed: %d\n", |
| 1767 | + priv->netdev->name, ret); |
| 1768 | + goto exit; |
| 1769 | + } |
| 1770 | + |
| 1771 | + at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x", |
| 1772 | + priv->netdev->name, |
| 1773 | + mac2str(m->mac_addr), m->res[0], m->res[1]); |
| 1774 | + for (i = 0; i < ARRAY_SIZE(m->group_addr); i++) |
| 1775 | + at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: group addr %d: %s, " |
| 1776 | + "status %d", priv->netdev->name, i, |
| 1777 | + mac2str(m->group_addr[i]), m->group_addr_status[i]); |
| 1778 | +exit: |
| 1779 | + kfree(m); |
| 1780 | +} |
| 1781 | + |
| 1782 | +static void at76_dump_mib_mac_wep(struct at76_priv *priv) |
| 1783 | +{ |
| 1784 | + int i; |
| 1785 | + int ret; |
| 1786 | + int key_len; |
| 1787 | + struct mib_mac_wep *m = kmalloc(sizeof(struct mib_mac_wep), GFP_KERNEL); |
| 1788 | + |
| 1789 | + if (!m) |
| 1790 | + return; |
| 1791 | + |
| 1792 | + ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m, |
| 1793 | + sizeof(struct mib_mac_wep)); |
| 1794 | + if (ret < 0) { |
| 1795 | + printk(KERN_ERR "%s: at76_get_mib (MAC_WEP) failed: %d\n", |
| 1796 | + priv->netdev->name, ret); |
| 1797 | + goto exit; |
| 1798 | + } |
| 1799 | + |
| 1800 | + at76_dbg(DBG_MIB, "%s: MIB MAC_WEP: priv_invoked %u def_key_id %u " |
| 1801 | + "key_len %u excl_unencr %u wep_icv_err %u wep_excluded %u " |
| 1802 | + "encr_level %u key %d", priv->netdev->name, |
| 1803 | + m->privacy_invoked, m->wep_default_key_id, |
| 1804 | + m->wep_key_mapping_len, m->exclude_unencrypted, |
| 1805 | + le32_to_cpu(m->wep_icv_error_count), |
| 1806 | + le32_to_cpu(m->wep_excluded_count), m->encryption_level, |
| 1807 | + m->wep_default_key_id); |
| 1808 | + |
| 1809 | + key_len = (m->encryption_level == 1) ? |
| 1810 | + WEP_SMALL_KEY_LEN : WEP_LARGE_KEY_LEN; |
| 1811 | + |
| 1812 | + for (i = 0; i < WEP_KEYS; i++) |
| 1813 | + at76_dbg(DBG_MIB, "%s: MIB MAC_WEP: key %d: %s", |
| 1814 | + priv->netdev->name, i, |
| 1815 | + hex2str(m->wep_default_keyvalue[i], key_len)); |
| 1816 | +exit: |
| 1817 | + kfree(m); |
| 1818 | +} |
| 1819 | + |
| 1820 | +static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) |
| 1821 | +{ |
| 1822 | + int ret; |
| 1823 | + struct mib_mac_mgmt *m = kmalloc(sizeof(struct mib_mac_mgmt), |
| 1824 | + GFP_KERNEL); |
| 1825 | + |
| 1826 | + if (!m) |
| 1827 | + return; |
| 1828 | + |
| 1829 | + ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m, |
| 1830 | + sizeof(struct mib_mac_mgmt)); |
| 1831 | + if (ret < 0) { |
| 1832 | + printk(KERN_ERR "%s: at76_get_mib (MAC_MGMT) failed: %d\n", |
| 1833 | + priv->netdev->name, ret); |
| 1834 | + goto exit; |
| 1835 | + } |
| 1836 | + |
| 1837 | + at76_dbg(DBG_MIB, "%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration " |
| 1838 | + "%d medium_occupancy_limit %d station_id 0x%x ATIM_window %d " |
| 1839 | + "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d " |
| 1840 | + "current_bssid %s current_essid %s current_bss_type %d " |
| 1841 | + "pm_mode %d ibss_change %d res %d " |
| 1842 | + "multi_domain_capability_implemented %d " |
| 1843 | + "international_roaming %d country_string %.3s", |
| 1844 | + priv->netdev->name, le16_to_cpu(m->beacon_period), |
| 1845 | + le16_to_cpu(m->CFP_max_duration), |
| 1846 | + le16_to_cpu(m->medium_occupancy_limit), |
| 1847 | + le16_to_cpu(m->station_id), le16_to_cpu(m->ATIM_window), |
| 1848 | + m->CFP_mode, m->privacy_option_implemented, m->DTIM_period, |
| 1849 | + m->CFP_period, mac2str(m->current_bssid), |
| 1850 | + hex2str(m->current_essid, IW_ESSID_MAX_SIZE), |
| 1851 | + m->current_bss_type, m->power_mgmt_mode, m->ibss_change, |
| 1852 | + m->res, m->multi_domain_capability_implemented, |
| 1853 | + m->multi_domain_capability_enabled, m->country_string); |
| 1854 | +exit: |
| 1855 | + kfree(m); |
| 1856 | +} |
| 1857 | + |
| 1858 | +static void at76_dump_mib_mac(struct at76_priv *priv) |
| 1859 | +{ |
| 1860 | + int ret; |
| 1861 | + struct mib_mac *m = kmalloc(sizeof(struct mib_mac), GFP_KERNEL); |
| 1862 | + |
| 1863 | + if (!m) |
| 1864 | + return; |
| 1865 | + |
| 1866 | + ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); |
| 1867 | + if (ret < 0) { |
| 1868 | + printk(KERN_ERR "%s: at76_get_mib (MAC) failed: %d\n", |
| 1869 | + priv->netdev->name, ret); |
| 1870 | + goto exit; |
| 1871 | + } |
| 1872 | + |
| 1873 | + at76_dbg(DBG_MIB, "%s: MIB MAC: max_tx_msdu_lifetime %d " |
| 1874 | + "max_rx_lifetime %d frag_threshold %d rts_threshold %d " |
| 1875 | + "cwmin %d cwmax %d short_retry_time %d long_retry_time %d " |
| 1876 | + "scan_type %d scan_channel %d probe_delay %u " |
| 1877 | + "min_channel_time %d max_channel_time %d listen_int %d " |
| 1878 | + "desired_ssid %s desired_bssid %s desired_bsstype %d", |
| 1879 | + priv->netdev->name, le32_to_cpu(m->max_tx_msdu_lifetime), |
| 1880 | + le32_to_cpu(m->max_rx_lifetime), |
| 1881 | + le16_to_cpu(m->frag_threshold), le16_to_cpu(m->rts_threshold), |
| 1882 | + le16_to_cpu(m->cwmin), le16_to_cpu(m->cwmax), |
| 1883 | + m->short_retry_time, m->long_retry_time, m->scan_type, |
| 1884 | + m->scan_channel, le16_to_cpu(m->probe_delay), |
| 1885 | + le16_to_cpu(m->min_channel_time), |
| 1886 | + le16_to_cpu(m->max_channel_time), |
| 1887 | + le16_to_cpu(m->listen_interval), |
| 1888 | + hex2str(m->desired_ssid, IW_ESSID_MAX_SIZE), |
| 1889 | + mac2str(m->desired_bssid), m->desired_bsstype); |
| 1890 | +exit: |
| 1891 | + kfree(m); |
| 1892 | +} |
| 1893 | + |
| 1894 | +static void at76_dump_mib_phy(struct at76_priv *priv) |
| 1895 | +{ |
| 1896 | + int ret; |
| 1897 | + struct mib_phy *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL); |
| 1898 | + |
| 1899 | + if (!m) |
| 1900 | + return; |
| 1901 | + |
| 1902 | + ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); |
| 1903 | + if (ret < 0) { |
| 1904 | + printk(KERN_ERR "%s: at76_get_mib (PHY) failed: %d\n", |
| 1905 | + priv->netdev->name, ret); |
| 1906 | + goto exit; |
| 1907 | + } |
| 1908 | + |
| 1909 | + at76_dbg(DBG_MIB, "%s: MIB PHY: ed_threshold %d slot_time %d " |
| 1910 | + "sifs_time %d preamble_length %d plcp_header_length %d " |
| 1911 | + "mpdu_max_length %d cca_mode_supported %d operation_rate_set " |
| 1912 | + "0x%x 0x%x 0x%x 0x%x channel_id %d current_cca_mode %d " |
| 1913 | + "phy_type %d current_reg_domain %d", |
| 1914 | + priv->netdev->name, le32_to_cpu(m->ed_threshold), |
| 1915 | + le16_to_cpu(m->slot_time), le16_to_cpu(m->sifs_time), |
| 1916 | + le16_to_cpu(m->preamble_length), |
| 1917 | + le16_to_cpu(m->plcp_header_length), |
| 1918 | + le16_to_cpu(m->mpdu_max_length), |
| 1919 | + le16_to_cpu(m->cca_mode_supported), m->operation_rate_set[0], |
| 1920 | + m->operation_rate_set[1], m->operation_rate_set[2], |
| 1921 | + m->operation_rate_set[3], m->channel_id, m->current_cca_mode, |
| 1922 | + m->phy_type, m->current_reg_domain); |
| 1923 | +exit: |
| 1924 | + kfree(m); |
| 1925 | +} |
| 1926 | + |
| 1927 | +static void at76_dump_mib_local(struct at76_priv *priv) |
| 1928 | +{ |
| 1929 | + int ret; |
| 1930 | + struct mib_local *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL); |
| 1931 | + |
| 1932 | + if (!m) |
| 1933 | + return; |
| 1934 | + |
| 1935 | + ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local)); |
| 1936 | + if (ret < 0) { |
| 1937 | + printk(KERN_ERR "%s: at76_get_mib (LOCAL) failed: %d\n", |
| 1938 | + priv->netdev->name, ret); |
| 1939 | + goto exit; |
| 1940 | + } |
| 1941 | + |
| 1942 | + at76_dbg(DBG_MIB, "%s: MIB LOCAL: beacon_enable %d " |
| 1943 | + "txautorate_fallback %d ssid_size %d promiscuous_mode %d " |
| 1944 | + "preamble_type %d", priv->netdev->name, m->beacon_enable, |
| 1945 | + m->txautorate_fallback, m->ssid_size, m->promiscuous_mode, |
| 1946 | + m->preamble_type); |
| 1947 | +exit: |
| 1948 | + kfree(m); |
| 1949 | +} |
| 1950 | + |
| 1951 | +static void at76_dump_mib_mdomain(struct at76_priv *priv) |
| 1952 | +{ |
| 1953 | + int ret; |
| 1954 | + struct mib_mdomain *m = kmalloc(sizeof(struct mib_mdomain), GFP_KERNEL); |
| 1955 | + |
| 1956 | + if (!m) |
| 1957 | + return; |
| 1958 | + |
| 1959 | + ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m, |
| 1960 | + sizeof(struct mib_mdomain)); |
| 1961 | + if (ret < 0) { |
| 1962 | + printk(KERN_ERR "%s: at76_get_mib (MDOMAIN) failed: %d\n", |
| 1963 | + priv->netdev->name, ret); |
| 1964 | + goto exit; |
| 1965 | + } |
| 1966 | + |
| 1967 | + at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s", |
| 1968 | + priv->netdev->name, |
| 1969 | + hex2str(m->channel_list, sizeof(m->channel_list))); |
| 1970 | + |
| 1971 | + at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: tx_powerlevel %s", |
| 1972 | + priv->netdev->name, |
| 1973 | + hex2str(m->tx_powerlevel, sizeof(m->tx_powerlevel))); |
| 1974 | +exit: |
| 1975 | + kfree(m); |
| 1976 | +} |
| 1977 | + |
| 1978 | +static int at76_get_current_bssid(struct at76_priv *priv) |
| 1979 | +{ |
| 1980 | + int ret = 0; |
| 1981 | + struct mib_mac_mgmt *mac_mgmt = |
| 1982 | + kmalloc(sizeof(struct mib_mac_mgmt), GFP_KERNEL); |
| 1983 | + |
| 1984 | + if (!mac_mgmt) { |
| 1985 | + ret = -ENOMEM; |
| 1986 | + goto exit; |
| 1987 | + } |
| 1988 | + |
| 1989 | + ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, mac_mgmt, |
| 1990 | + sizeof(struct mib_mac_mgmt)); |
| 1991 | + if (ret < 0) { |
| 1992 | + printk(KERN_ERR "%s: at76_get_mib failed: %d\n", |
| 1993 | + priv->netdev->name, ret); |
| 1994 | + goto error; |
| 1995 | + } |
| 1996 | + memcpy(priv->bssid, mac_mgmt->current_bssid, ETH_ALEN); |
| 1997 | + printk(KERN_INFO "%s: using BSSID %s\n", priv->netdev->name, |
| 1998 | + mac2str(priv->bssid)); |
| 1999 | +error: |
| 2000 | + kfree(mac_mgmt); |
| 2001 | +exit: |
| 2002 | + return ret; |
| 2003 | +} |
| 2004 | + |
| 2005 | +static int at76_get_current_channel(struct at76_priv *priv) |
| 2006 | +{ |
| 2007 | + int ret = 0; |
| 2008 | + struct mib_phy *phy = kmalloc(sizeof(struct mib_phy), GFP_KERNEL); |
| 2009 | + |
| 2010 | + if (!phy) { |
| 2011 | + ret = -ENOMEM; |
| 2012 | + goto exit; |
| 2013 | + } |
| 2014 | + ret = at76_get_mib(priv->udev, MIB_PHY, phy, sizeof(struct mib_phy)); |
| 2015 | + if (ret < 0) { |
| 2016 | + printk(KERN_ERR "%s: at76_get_mib(MIB_PHY) failed: %d\n", |
| 2017 | + priv->netdev->name, ret); |
| 2018 | + goto error; |
| 2019 | + } |
| 2020 | + priv->channel = phy->channel_id; |
| 2021 | +error: |
| 2022 | + kfree(phy); |
| 2023 | +exit: |
| 2024 | + return ret; |
| 2025 | +} |
| 2026 | + |
| 2027 | +/** |
| 2028 | + * at76_start_scan - start a scan |
| 2029 | + * |
| 2030 | + * @use_essid - use the configured ESSID in non passive mode |
| 2031 | + */ |
| 2032 | +static int at76_start_scan(struct at76_priv *priv, int use_essid) |
| 2033 | +{ |
| 2034 | + struct at76_req_scan scan; |
| 2035 | + |
| 2036 | + memset(&scan, |