Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4.13 2013 lines 55 kB view raw
1/* src/prism2/driver/prism2sta.c 2 * 3 * Implements the station functionality for prism2 4 * 5 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. 6 * -------------------------------------------------------------------- 7 * 8 * linux-wlan 9 * 10 * The contents of this file are subject to the Mozilla Public 11 * License Version 1.1 (the "License"); you may not use this file 12 * except in compliance with the License. You may obtain a copy of 13 * the License at http://www.mozilla.org/MPL/ 14 * 15 * Software distributed under the License is distributed on an "AS 16 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 17 * implied. See the License for the specific language governing 18 * rights and limitations under the License. 19 * 20 * Alternatively, the contents of this file may be used under the 21 * terms of the GNU Public License version 2 (the "GPL"), in which 22 * case the provisions of the GPL are applicable instead of the 23 * above. If you wish to allow the use of your version of this file 24 * only under the terms of the GPL and not to allow others to use 25 * your version of this file under the MPL, indicate your decision 26 * by deleting the provisions above and replace them with the notice 27 * and other provisions required by the GPL. If you do not delete 28 * the provisions above, a recipient may use your version of this 29 * file under either the MPL or the GPL. 30 * 31 * -------------------------------------------------------------------- 32 * 33 * Inquiries regarding the linux-wlan Open Source project can be 34 * made directly to: 35 * 36 * AbsoluteValue Systems Inc. 37 * info@linux-wlan.com 38 * http://www.linux-wlan.com 39 * 40 * -------------------------------------------------------------------- 41 * 42 * Portions of the development of this software were funded by 43 * Intersil Corporation as part of PRISM(R) chipset product development. 44 * 45 * -------------------------------------------------------------------- 46 * 47 * This file implements the module and linux pcmcia routines for the 48 * prism2 driver. 49 * 50 * -------------------------------------------------------------------- 51 */ 52 53#include <linux/module.h> 54#include <linux/kernel.h> 55#include <linux/sched.h> 56#include <linux/types.h> 57#include <linux/slab.h> 58#include <linux/wireless.h> 59#include <linux/netdevice.h> 60#include <linux/workqueue.h> 61#include <linux/byteorder/generic.h> 62#include <linux/etherdevice.h> 63 64#include <linux/io.h> 65#include <linux/delay.h> 66#include <asm/byteorder.h> 67#include <linux/if_arp.h> 68#include <linux/if_ether.h> 69#include <linux/bitops.h> 70 71#include "p80211types.h" 72#include "p80211hdr.h" 73#include "p80211mgmt.h" 74#include "p80211conv.h" 75#include "p80211msg.h" 76#include "p80211netdev.h" 77#include "p80211req.h" 78#include "p80211metadef.h" 79#include "p80211metastruct.h" 80#include "hfa384x.h" 81#include "prism2mgmt.h" 82 83static char *dev_info = "prism2_usb"; 84static struct wlandevice *create_wlan(void); 85 86int prism2_reset_holdtime = 30; /* Reset hold time in ms */ 87int prism2_reset_settletime = 100; /* Reset settle time in ms */ 88 89static int prism2_doreset; /* Do a reset at init? */ 90 91module_param(prism2_doreset, int, 0644); 92MODULE_PARM_DESC(prism2_doreset, "Issue a reset on initialization"); 93 94module_param(prism2_reset_holdtime, int, 0644); 95MODULE_PARM_DESC(prism2_reset_holdtime, "reset hold time in ms"); 96module_param(prism2_reset_settletime, int, 0644); 97MODULE_PARM_DESC(prism2_reset_settletime, "reset settle time in ms"); 98 99MODULE_LICENSE("Dual MPL/GPL"); 100 101static int prism2sta_open(struct wlandevice *wlandev); 102static int prism2sta_close(struct wlandevice *wlandev); 103static void prism2sta_reset(struct wlandevice *wlandev); 104static int prism2sta_txframe(struct wlandevice *wlandev, struct sk_buff *skb, 105 union p80211_hdr *p80211_hdr, 106 struct p80211_metawep *p80211_wep); 107static int prism2sta_mlmerequest(struct wlandevice *wlandev, 108 struct p80211msg *msg); 109static int prism2sta_getcardinfo(struct wlandevice *wlandev); 110static int prism2sta_globalsetup(struct wlandevice *wlandev); 111static int prism2sta_setmulticast(struct wlandevice *wlandev, 112 struct net_device *dev); 113 114static void prism2sta_inf_handover(struct wlandevice *wlandev, 115 struct hfa384x_inf_frame *inf); 116static void prism2sta_inf_tallies(struct wlandevice *wlandev, 117 struct hfa384x_inf_frame *inf); 118static void prism2sta_inf_hostscanresults(struct wlandevice *wlandev, 119 struct hfa384x_inf_frame *inf); 120static void prism2sta_inf_scanresults(struct wlandevice *wlandev, 121 struct hfa384x_inf_frame *inf); 122static void prism2sta_inf_chinforesults(struct wlandevice *wlandev, 123 struct hfa384x_inf_frame *inf); 124static void prism2sta_inf_linkstatus(struct wlandevice *wlandev, 125 struct hfa384x_inf_frame *inf); 126static void prism2sta_inf_assocstatus(struct wlandevice *wlandev, 127 struct hfa384x_inf_frame *inf); 128static void prism2sta_inf_authreq(struct wlandevice *wlandev, 129 struct hfa384x_inf_frame *inf); 130static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev, 131 struct hfa384x_inf_frame *inf); 132static void prism2sta_inf_psusercnt(struct wlandevice *wlandev, 133 struct hfa384x_inf_frame *inf); 134 135/* 136 * prism2sta_open 137 * 138 * WLAN device open method. Called from p80211netdev when kernel 139 * device open (start) method is called in response to the 140 * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP 141 * from clear to set. 142 * 143 * Arguments: 144 * wlandev wlan device structure 145 * 146 * Returns: 147 * 0 success 148 * >0 f/w reported error 149 * <0 driver reported error 150 * 151 * Side effects: 152 * 153 * Call context: 154 * process thread 155 */ 156static int prism2sta_open(struct wlandevice *wlandev) 157{ 158 /* We don't currently have to do anything else. 159 * The setup of the MAC should be subsequently completed via 160 * the mlme commands. 161 * Higher layers know we're ready from dev->start==1 and 162 * dev->tbusy==0. Our rx path knows to pass up received/ 163 * frames because of dev->flags&IFF_UP is true. 164 */ 165 166 return 0; 167} 168 169/* 170 * prism2sta_close 171 * 172 * WLAN device close method. Called from p80211netdev when kernel 173 * device close method is called in response to the 174 * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP 175 * from set to clear. 176 * 177 * Arguments: 178 * wlandev wlan device structure 179 * 180 * Returns: 181 * 0 success 182 * >0 f/w reported error 183 * <0 driver reported error 184 * 185 * Side effects: 186 * 187 * Call context: 188 * process thread 189 */ 190static int prism2sta_close(struct wlandevice *wlandev) 191{ 192 /* We don't currently have to do anything else. 193 * Higher layers know we're not ready from dev->start==0 and 194 * dev->tbusy==1. Our rx path knows to not pass up received 195 * frames because of dev->flags&IFF_UP is false. 196 */ 197 198 return 0; 199} 200 201/* 202 * prism2sta_reset 203 * 204 * Currently not implemented. 205 * 206 * Arguments: 207 * wlandev wlan device structure 208 * none 209 * 210 * Returns: 211 * nothing 212 * 213 * Side effects: 214 * 215 * Call context: 216 * process thread 217 */ 218static void prism2sta_reset(struct wlandevice *wlandev) 219{ 220} 221 222/* 223 * prism2sta_txframe 224 * 225 * Takes a frame from p80211 and queues it for transmission. 226 * 227 * Arguments: 228 * wlandev wlan device structure 229 * pb packet buffer struct. Contains an 802.11 230 * data frame. 231 * p80211_hdr points to the 802.11 header for the packet. 232 * Returns: 233 * 0 Success and more buffs available 234 * 1 Success but no more buffs 235 * 2 Allocation failure 236 * 4 Buffer full or queue busy 237 * 238 * Side effects: 239 * 240 * Call context: 241 * process thread 242 */ 243static int prism2sta_txframe(struct wlandevice *wlandev, struct sk_buff *skb, 244 union p80211_hdr *p80211_hdr, 245 struct p80211_metawep *p80211_wep) 246{ 247 struct hfa384x *hw = wlandev->priv; 248 249 /* If necessary, set the 802.11 WEP bit */ 250 if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == 251 HOSTWEP_PRIVACYINVOKED) { 252 p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1)); 253 } 254 255 return hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep); 256} 257 258/* 259 * prism2sta_mlmerequest 260 * 261 * wlan command message handler. All we do here is pass the message 262 * over to the prism2sta_mgmt_handler. 263 * 264 * Arguments: 265 * wlandev wlan device structure 266 * msg wlan command message 267 * Returns: 268 * 0 success 269 * <0 successful acceptance of message, but we're 270 * waiting for an async process to finish before 271 * we're done with the msg. When the asynch 272 * process is done, we'll call the p80211 273 * function p80211req_confirm() . 274 * >0 An error occurred while we were handling 275 * the message. 276 * 277 * Side effects: 278 * 279 * Call context: 280 * process thread 281 */ 282static int prism2sta_mlmerequest(struct wlandevice *wlandev, 283 struct p80211msg *msg) 284{ 285 struct hfa384x *hw = wlandev->priv; 286 287 int result = 0; 288 289 switch (msg->msgcode) { 290 case DIDmsg_dot11req_mibget: 291 pr_debug("Received mibget request\n"); 292 result = prism2mgmt_mibset_mibget(wlandev, msg); 293 break; 294 case DIDmsg_dot11req_mibset: 295 pr_debug("Received mibset request\n"); 296 result = prism2mgmt_mibset_mibget(wlandev, msg); 297 break; 298 case DIDmsg_dot11req_scan: 299 pr_debug("Received scan request\n"); 300 result = prism2mgmt_scan(wlandev, msg); 301 break; 302 case DIDmsg_dot11req_scan_results: 303 pr_debug("Received scan_results request\n"); 304 result = prism2mgmt_scan_results(wlandev, msg); 305 break; 306 case DIDmsg_dot11req_start: 307 pr_debug("Received mlme start request\n"); 308 result = prism2mgmt_start(wlandev, msg); 309 break; 310 /* 311 * Prism2 specific messages 312 */ 313 case DIDmsg_p2req_readpda: 314 pr_debug("Received mlme readpda request\n"); 315 result = prism2mgmt_readpda(wlandev, msg); 316 break; 317 case DIDmsg_p2req_ramdl_state: 318 pr_debug("Received mlme ramdl_state request\n"); 319 result = prism2mgmt_ramdl_state(wlandev, msg); 320 break; 321 case DIDmsg_p2req_ramdl_write: 322 pr_debug("Received mlme ramdl_write request\n"); 323 result = prism2mgmt_ramdl_write(wlandev, msg); 324 break; 325 case DIDmsg_p2req_flashdl_state: 326 pr_debug("Received mlme flashdl_state request\n"); 327 result = prism2mgmt_flashdl_state(wlandev, msg); 328 break; 329 case DIDmsg_p2req_flashdl_write: 330 pr_debug("Received mlme flashdl_write request\n"); 331 result = prism2mgmt_flashdl_write(wlandev, msg); 332 break; 333 /* 334 * Linux specific messages 335 */ 336 case DIDmsg_lnxreq_hostwep: 337 break; /* ignore me. */ 338 case DIDmsg_lnxreq_ifstate: 339 { 340 struct p80211msg_lnxreq_ifstate *ifstatemsg; 341 342 pr_debug("Received mlme ifstate request\n"); 343 ifstatemsg = (struct p80211msg_lnxreq_ifstate *)msg; 344 result = 345 prism2sta_ifstate(wlandev, 346 ifstatemsg->ifstate.data); 347 ifstatemsg->resultcode.status = 348 P80211ENUM_msgitem_status_data_ok; 349 ifstatemsg->resultcode.data = result; 350 result = 0; 351 } 352 break; 353 case DIDmsg_lnxreq_wlansniff: 354 pr_debug("Received mlme wlansniff request\n"); 355 result = prism2mgmt_wlansniff(wlandev, msg); 356 break; 357 case DIDmsg_lnxreq_autojoin: 358 pr_debug("Received mlme autojoin request\n"); 359 result = prism2mgmt_autojoin(wlandev, msg); 360 break; 361 case DIDmsg_lnxreq_commsquality:{ 362 struct p80211msg_lnxreq_commsquality *qualmsg; 363 364 pr_debug("Received commsquality request\n"); 365 366 qualmsg = (struct p80211msg_lnxreq_commsquality *)msg; 367 368 qualmsg->link.status = 369 P80211ENUM_msgitem_status_data_ok; 370 qualmsg->level.status = 371 P80211ENUM_msgitem_status_data_ok; 372 qualmsg->noise.status = 373 P80211ENUM_msgitem_status_data_ok; 374 375 qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss); 376 qualmsg->level.data = 377 le16_to_cpu(hw->qual.asl_curr_bss); 378 qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc); 379 qualmsg->txrate.data = hw->txrate; 380 381 break; 382 } 383 default: 384 netdev_warn(wlandev->netdev, 385 "Unknown mgmt request message 0x%08x", 386 msg->msgcode); 387 break; 388 } 389 390 return result; 391} 392 393/* 394 * prism2sta_ifstate 395 * 396 * Interface state. This is the primary WLAN interface enable/disable 397 * handler. Following the driver/load/deviceprobe sequence, this 398 * function must be called with a state of "enable" before any other 399 * commands will be accepted. 400 * 401 * Arguments: 402 * wlandev wlan device structure 403 * msgp ptr to msg buffer 404 * 405 * Returns: 406 * A p80211 message resultcode value. 407 * 408 * Side effects: 409 * 410 * Call context: 411 * process thread (usually) 412 * interrupt 413 */ 414u32 prism2sta_ifstate(struct wlandevice *wlandev, u32 ifstate) 415{ 416 struct hfa384x *hw = wlandev->priv; 417 u32 result; 418 419 result = P80211ENUM_resultcode_implementation_failure; 420 421 pr_debug("Current MSD state(%d), requesting(%d)\n", 422 wlandev->msdstate, ifstate); 423 switch (ifstate) { 424 case P80211ENUM_ifstate_fwload: 425 switch (wlandev->msdstate) { 426 case WLAN_MSD_HWPRESENT: 427 wlandev->msdstate = WLAN_MSD_FWLOAD_PENDING; 428 /* 429 * Initialize the device+driver sufficiently 430 * for firmware loading. 431 */ 432 result = hfa384x_drvr_start(hw); 433 if (result) { 434 netdev_err(wlandev->netdev, 435 "hfa384x_drvr_start() failed,result=%d\n", 436 (int)result); 437 result = 438 P80211ENUM_resultcode_implementation_failure; 439 wlandev->msdstate = WLAN_MSD_HWPRESENT; 440 break; 441 } 442 wlandev->msdstate = WLAN_MSD_FWLOAD; 443 result = P80211ENUM_resultcode_success; 444 break; 445 case WLAN_MSD_FWLOAD: 446 hfa384x_cmd_initialize(hw); 447 result = P80211ENUM_resultcode_success; 448 break; 449 case WLAN_MSD_RUNNING: 450 netdev_warn(wlandev->netdev, 451 "Cannot enter fwload state from enable state, you must disable first.\n"); 452 result = P80211ENUM_resultcode_invalid_parameters; 453 break; 454 case WLAN_MSD_HWFAIL: 455 default: 456 /* probe() had a problem or the msdstate contains 457 * an unrecognized value, there's nothing we can do. 458 */ 459 result = P80211ENUM_resultcode_implementation_failure; 460 break; 461 } 462 break; 463 case P80211ENUM_ifstate_enable: 464 switch (wlandev->msdstate) { 465 case WLAN_MSD_HWPRESENT: 466 case WLAN_MSD_FWLOAD: 467 wlandev->msdstate = WLAN_MSD_RUNNING_PENDING; 468 /* Initialize the device+driver for full 469 * operation. Note that this might me an FWLOAD to 470 * to RUNNING transition so we must not do a chip 471 * or board level reset. Note that on failure, 472 * the MSD state is set to HWPRESENT because we 473 * can't make any assumptions about the state 474 * of the hardware or a previous firmware load. 475 */ 476 result = hfa384x_drvr_start(hw); 477 if (result) { 478 netdev_err(wlandev->netdev, 479 "hfa384x_drvr_start() failed,result=%d\n", 480 (int)result); 481 result = 482 P80211ENUM_resultcode_implementation_failure; 483 wlandev->msdstate = WLAN_MSD_HWPRESENT; 484 break; 485 } 486 487 result = prism2sta_getcardinfo(wlandev); 488 if (result) { 489 netdev_err(wlandev->netdev, 490 "prism2sta_getcardinfo() failed,result=%d\n", 491 (int)result); 492 result = 493 P80211ENUM_resultcode_implementation_failure; 494 hfa384x_drvr_stop(hw); 495 wlandev->msdstate = WLAN_MSD_HWPRESENT; 496 break; 497 } 498 result = prism2sta_globalsetup(wlandev); 499 if (result) { 500 netdev_err(wlandev->netdev, 501 "prism2sta_globalsetup() failed,result=%d\n", 502 (int)result); 503 result = 504 P80211ENUM_resultcode_implementation_failure; 505 hfa384x_drvr_stop(hw); 506 wlandev->msdstate = WLAN_MSD_HWPRESENT; 507 break; 508 } 509 wlandev->msdstate = WLAN_MSD_RUNNING; 510 hw->join_ap = 0; 511 hw->join_retries = 60; 512 result = P80211ENUM_resultcode_success; 513 break; 514 case WLAN_MSD_RUNNING: 515 /* Do nothing, we're already in this state. */ 516 result = P80211ENUM_resultcode_success; 517 break; 518 case WLAN_MSD_HWFAIL: 519 default: 520 /* probe() had a problem or the msdstate contains 521 * an unrecognized value, there's nothing we can do. 522 */ 523 result = P80211ENUM_resultcode_implementation_failure; 524 break; 525 } 526 break; 527 case P80211ENUM_ifstate_disable: 528 switch (wlandev->msdstate) { 529 case WLAN_MSD_HWPRESENT: 530 /* Do nothing, we're already in this state. */ 531 result = P80211ENUM_resultcode_success; 532 break; 533 case WLAN_MSD_FWLOAD: 534 case WLAN_MSD_RUNNING: 535 wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING; 536 /* 537 * TODO: Shut down the MAC completely. Here a chip 538 * or board level reset is probably called for. 539 * After a "disable" _all_ results are lost, even 540 * those from a fwload. 541 */ 542 if (!wlandev->hwremoved) 543 netif_carrier_off(wlandev->netdev); 544 545 hfa384x_drvr_stop(hw); 546 547 wlandev->macmode = WLAN_MACMODE_NONE; 548 wlandev->msdstate = WLAN_MSD_HWPRESENT; 549 result = P80211ENUM_resultcode_success; 550 break; 551 case WLAN_MSD_HWFAIL: 552 default: 553 /* probe() had a problem or the msdstate contains 554 * an unrecognized value, there's nothing we can do. 555 */ 556 result = P80211ENUM_resultcode_implementation_failure; 557 break; 558 } 559 break; 560 default: 561 result = P80211ENUM_resultcode_invalid_parameters; 562 break; 563 } 564 565 return result; 566} 567 568/* 569 * prism2sta_getcardinfo 570 * 571 * Collect the NICID, firmware version and any other identifiers 572 * we'd like to have in host-side data structures. 573 * 574 * Arguments: 575 * wlandev wlan device structure 576 * 577 * Returns: 578 * 0 success 579 * >0 f/w reported error 580 * <0 driver reported error 581 * 582 * Side effects: 583 * 584 * Call context: 585 * Either. 586 */ 587static int prism2sta_getcardinfo(struct wlandevice *wlandev) 588{ 589 int result = 0; 590 struct hfa384x *hw = wlandev->priv; 591 u16 temp; 592 u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN]; 593 594 /* Collect version and compatibility info */ 595 /* Some are critical, some are not */ 596 /* NIC identity */ 597 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY, 598 &hw->ident_nic, 599 sizeof(struct hfa384x_compident)); 600 if (result) { 601 netdev_err(wlandev->netdev, "Failed to retrieve NICIDENTITY\n"); 602 goto failed; 603 } 604 605 /* get all the nic id fields in host byte order */ 606 le16_to_cpus(&hw->ident_nic.id); 607 le16_to_cpus(&hw->ident_nic.variant); 608 le16_to_cpus(&hw->ident_nic.major); 609 le16_to_cpus(&hw->ident_nic.minor); 610 611 netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n", 612 hw->ident_nic.id, hw->ident_nic.major, 613 hw->ident_nic.minor, hw->ident_nic.variant); 614 615 /* Primary f/w identity */ 616 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY, 617 &hw->ident_pri_fw, 618 sizeof(struct hfa384x_compident)); 619 if (result) { 620 netdev_err(wlandev->netdev, "Failed to retrieve PRIIDENTITY\n"); 621 goto failed; 622 } 623 624 /* get all the private fw id fields in host byte order */ 625 le16_to_cpus(&hw->ident_pri_fw.id); 626 le16_to_cpus(&hw->ident_pri_fw.variant); 627 le16_to_cpus(&hw->ident_pri_fw.major); 628 le16_to_cpus(&hw->ident_pri_fw.minor); 629 630 netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n", 631 hw->ident_pri_fw.id, hw->ident_pri_fw.major, 632 hw->ident_pri_fw.minor, hw->ident_pri_fw.variant); 633 634 /* Station (Secondary?) f/w identity */ 635 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY, 636 &hw->ident_sta_fw, 637 sizeof(struct hfa384x_compident)); 638 if (result) { 639 netdev_err(wlandev->netdev, "Failed to retrieve STAIDENTITY\n"); 640 goto failed; 641 } 642 643 if (hw->ident_nic.id < 0x8000) { 644 netdev_err(wlandev->netdev, 645 "FATAL: Card is not an Intersil Prism2/2.5/3\n"); 646 result = -1; 647 goto failed; 648 } 649 650 /* get all the station fw id fields in host byte order */ 651 le16_to_cpus(&hw->ident_sta_fw.id); 652 le16_to_cpus(&hw->ident_sta_fw.variant); 653 le16_to_cpus(&hw->ident_sta_fw.major); 654 le16_to_cpus(&hw->ident_sta_fw.minor); 655 656 /* strip out the 'special' variant bits */ 657 hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14); 658 hw->ident_sta_fw.variant &= ~((u16)GENMASK(15, 14)); 659 660 if (hw->ident_sta_fw.id == 0x1f) { 661 netdev_info(wlandev->netdev, 662 "ident: sta f/w: id=0x%02x %d.%d.%d\n", 663 hw->ident_sta_fw.id, hw->ident_sta_fw.major, 664 hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); 665 } else { 666 netdev_info(wlandev->netdev, 667 "ident: ap f/w: id=0x%02x %d.%d.%d\n", 668 hw->ident_sta_fw.id, hw->ident_sta_fw.major, 669 hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); 670 netdev_err(wlandev->netdev, "Unsupported Tertiary AP firmware loaded!\n"); 671 goto failed; 672 } 673 674 /* Compatibility range, Modem supplier */ 675 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE, 676 &hw->cap_sup_mfi, 677 sizeof(struct hfa384x_caplevel)); 678 if (result) { 679 netdev_err(wlandev->netdev, "Failed to retrieve MFISUPRANGE\n"); 680 goto failed; 681 } 682 683 /* get all the Compatibility range, modem interface supplier 684 * fields in byte order 685 */ 686 le16_to_cpus(&hw->cap_sup_mfi.role); 687 le16_to_cpus(&hw->cap_sup_mfi.id); 688 le16_to_cpus(&hw->cap_sup_mfi.variant); 689 le16_to_cpus(&hw->cap_sup_mfi.bottom); 690 le16_to_cpus(&hw->cap_sup_mfi.top); 691 692 netdev_info(wlandev->netdev, 693 "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", 694 hw->cap_sup_mfi.role, hw->cap_sup_mfi.id, 695 hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom, 696 hw->cap_sup_mfi.top); 697 698 /* Compatibility range, Controller supplier */ 699 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE, 700 &hw->cap_sup_cfi, 701 sizeof(struct hfa384x_caplevel)); 702 if (result) { 703 netdev_err(wlandev->netdev, "Failed to retrieve CFISUPRANGE\n"); 704 goto failed; 705 } 706 707 /* get all the Compatibility range, controller interface supplier 708 * fields in byte order 709 */ 710 le16_to_cpus(&hw->cap_sup_cfi.role); 711 le16_to_cpus(&hw->cap_sup_cfi.id); 712 le16_to_cpus(&hw->cap_sup_cfi.variant); 713 le16_to_cpus(&hw->cap_sup_cfi.bottom); 714 le16_to_cpus(&hw->cap_sup_cfi.top); 715 716 netdev_info(wlandev->netdev, 717 "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", 718 hw->cap_sup_cfi.role, hw->cap_sup_cfi.id, 719 hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom, 720 hw->cap_sup_cfi.top); 721 722 /* Compatibility range, Primary f/w supplier */ 723 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE, 724 &hw->cap_sup_pri, 725 sizeof(struct hfa384x_caplevel)); 726 if (result) { 727 netdev_err(wlandev->netdev, "Failed to retrieve PRISUPRANGE\n"); 728 goto failed; 729 } 730 731 /* get all the Compatibility range, primary firmware supplier 732 * fields in byte order 733 */ 734 le16_to_cpus(&hw->cap_sup_pri.role); 735 le16_to_cpus(&hw->cap_sup_pri.id); 736 le16_to_cpus(&hw->cap_sup_pri.variant); 737 le16_to_cpus(&hw->cap_sup_pri.bottom); 738 le16_to_cpus(&hw->cap_sup_pri.top); 739 740 netdev_info(wlandev->netdev, 741 "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", 742 hw->cap_sup_pri.role, hw->cap_sup_pri.id, 743 hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom, 744 hw->cap_sup_pri.top); 745 746 /* Compatibility range, Station f/w supplier */ 747 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE, 748 &hw->cap_sup_sta, 749 sizeof(struct hfa384x_caplevel)); 750 if (result) { 751 netdev_err(wlandev->netdev, "Failed to retrieve STASUPRANGE\n"); 752 goto failed; 753 } 754 755 /* get all the Compatibility range, station firmware supplier 756 * fields in byte order 757 */ 758 le16_to_cpus(&hw->cap_sup_sta.role); 759 le16_to_cpus(&hw->cap_sup_sta.id); 760 le16_to_cpus(&hw->cap_sup_sta.variant); 761 le16_to_cpus(&hw->cap_sup_sta.bottom); 762 le16_to_cpus(&hw->cap_sup_sta.top); 763 764 if (hw->cap_sup_sta.id == 0x04) { 765 netdev_info(wlandev->netdev, 766 "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", 767 hw->cap_sup_sta.role, hw->cap_sup_sta.id, 768 hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom, 769 hw->cap_sup_sta.top); 770 } else { 771 netdev_info(wlandev->netdev, 772 "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", 773 hw->cap_sup_sta.role, hw->cap_sup_sta.id, 774 hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom, 775 hw->cap_sup_sta.top); 776 } 777 778 /* Compatibility range, primary f/w actor, CFI supplier */ 779 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES, 780 &hw->cap_act_pri_cfi, 781 sizeof(struct hfa384x_caplevel)); 782 if (result) { 783 netdev_err(wlandev->netdev, "Failed to retrieve PRI_CFIACTRANGES\n"); 784 goto failed; 785 } 786 787 /* get all the Compatibility range, primary f/w actor, CFI supplier 788 * fields in byte order 789 */ 790 le16_to_cpus(&hw->cap_act_pri_cfi.role); 791 le16_to_cpus(&hw->cap_act_pri_cfi.id); 792 le16_to_cpus(&hw->cap_act_pri_cfi.variant); 793 le16_to_cpus(&hw->cap_act_pri_cfi.bottom); 794 le16_to_cpus(&hw->cap_act_pri_cfi.top); 795 796 netdev_info(wlandev->netdev, 797 "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", 798 hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id, 799 hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom, 800 hw->cap_act_pri_cfi.top); 801 802 /* Compatibility range, sta f/w actor, CFI supplier */ 803 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES, 804 &hw->cap_act_sta_cfi, 805 sizeof(struct hfa384x_caplevel)); 806 if (result) { 807 netdev_err(wlandev->netdev, "Failed to retrieve STA_CFIACTRANGES\n"); 808 goto failed; 809 } 810 811 /* get all the Compatibility range, station f/w actor, CFI supplier 812 * fields in byte order 813 */ 814 le16_to_cpus(&hw->cap_act_sta_cfi.role); 815 le16_to_cpus(&hw->cap_act_sta_cfi.id); 816 le16_to_cpus(&hw->cap_act_sta_cfi.variant); 817 le16_to_cpus(&hw->cap_act_sta_cfi.bottom); 818 le16_to_cpus(&hw->cap_act_sta_cfi.top); 819 820 netdev_info(wlandev->netdev, 821 "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", 822 hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id, 823 hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom, 824 hw->cap_act_sta_cfi.top); 825 826 /* Compatibility range, sta f/w actor, MFI supplier */ 827 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES, 828 &hw->cap_act_sta_mfi, 829 sizeof(struct hfa384x_caplevel)); 830 if (result) { 831 netdev_err(wlandev->netdev, "Failed to retrieve STA_MFIACTRANGES\n"); 832 goto failed; 833 } 834 835 /* get all the Compatibility range, station f/w actor, MFI supplier 836 * fields in byte order 837 */ 838 le16_to_cpus(&hw->cap_act_sta_mfi.role); 839 le16_to_cpus(&hw->cap_act_sta_mfi.id); 840 le16_to_cpus(&hw->cap_act_sta_mfi.variant); 841 le16_to_cpus(&hw->cap_act_sta_mfi.bottom); 842 le16_to_cpus(&hw->cap_act_sta_mfi.top); 843 844 netdev_info(wlandev->netdev, 845 "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", 846 hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id, 847 hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom, 848 hw->cap_act_sta_mfi.top); 849 850 /* Serial Number */ 851 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER, 852 snum, HFA384x_RID_NICSERIALNUMBER_LEN); 853 if (!result) { 854 netdev_info(wlandev->netdev, "Prism2 card SN: %*pEhp\n", 855 HFA384x_RID_NICSERIALNUMBER_LEN, snum); 856 } else { 857 netdev_err(wlandev->netdev, "Failed to retrieve Prism2 Card SN\n"); 858 goto failed; 859 } 860 861 /* Collect the MAC address */ 862 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR, 863 wlandev->netdev->dev_addr, ETH_ALEN); 864 if (result != 0) { 865 netdev_err(wlandev->netdev, "Failed to retrieve mac address\n"); 866 goto failed; 867 } 868 869 /* short preamble is always implemented */ 870 wlandev->nsdcaps |= P80211_NSDCAP_SHORT_PREAMBLE; 871 872 /* find out if hardware wep is implemented */ 873 hfa384x_drvr_getconfig16(hw, HFA384x_RID_PRIVACYOPTIMP, &temp); 874 if (temp) 875 wlandev->nsdcaps |= P80211_NSDCAP_HARDWAREWEP; 876 877 /* get the dBm Scaling constant */ 878 hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFDBMADJUST, &temp); 879 hw->dbmadjust = temp; 880 881 /* Only enable scan by default on newer firmware */ 882 if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, 883 hw->ident_sta_fw.minor, 884 hw->ident_sta_fw.variant) < 885 HFA384x_FIRMWARE_VERSION(1, 5, 5)) { 886 wlandev->nsdcaps |= P80211_NSDCAP_NOSCAN; 887 } 888 889 /* TODO: Set any internally managed config items */ 890 891 goto done; 892failed: 893 netdev_err(wlandev->netdev, "Failed, result=%d\n", result); 894done: 895 return result; 896} 897 898/* 899 * prism2sta_globalsetup 900 * 901 * Set any global RIDs that we want to set at device activation. 902 * 903 * Arguments: 904 * wlandev wlan device structure 905 * 906 * Returns: 907 * 0 success 908 * >0 f/w reported error 909 * <0 driver reported error 910 * 911 * Side effects: 912 * 913 * Call context: 914 * process thread 915 */ 916static int prism2sta_globalsetup(struct wlandevice *wlandev) 917{ 918 struct hfa384x *hw = wlandev->priv; 919 920 /* Set the maximum frame size */ 921 return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, 922 WLAN_DATA_MAXLEN); 923} 924 925static int prism2sta_setmulticast(struct wlandevice *wlandev, 926 struct net_device *dev) 927{ 928 int result = 0; 929 struct hfa384x *hw = wlandev->priv; 930 931 u16 promisc; 932 933 /* If we're not ready, what's the point? */ 934 if (hw->state != HFA384x_STATE_RUNNING) 935 goto exit; 936 937 if ((dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) 938 promisc = P80211ENUM_truth_true; 939 else 940 promisc = P80211ENUM_truth_false; 941 942 result = 943 hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE, 944 promisc); 945exit: 946 return result; 947} 948 949/* 950 * prism2sta_inf_handover 951 * 952 * Handles the receipt of a Handover info frame. Should only be present 953 * in APs only. 954 * 955 * Arguments: 956 * wlandev wlan device structure 957 * inf ptr to info frame (contents in hfa384x order) 958 * 959 * Returns: 960 * nothing 961 * 962 * Side effects: 963 * 964 * Call context: 965 * interrupt 966 */ 967static void prism2sta_inf_handover(struct wlandevice *wlandev, 968 struct hfa384x_inf_frame *inf) 969{ 970 pr_debug("received infoframe:HANDOVER (unhandled)\n"); 971} 972 973/* 974 * prism2sta_inf_tallies 975 * 976 * Handles the receipt of a CommTallies info frame. 977 * 978 * Arguments: 979 * wlandev wlan device structure 980 * inf ptr to info frame (contents in hfa384x order) 981 * 982 * Returns: 983 * nothing 984 * 985 * Side effects: 986 * 987 * Call context: 988 * interrupt 989 */ 990static void prism2sta_inf_tallies(struct wlandevice *wlandev, 991 struct hfa384x_inf_frame *inf) 992{ 993 struct hfa384x *hw = wlandev->priv; 994 u16 *src16; 995 u32 *dst; 996 u32 *src32; 997 int i; 998 int cnt; 999 1000 /* 1001 * Determine if these are 16-bit or 32-bit tallies, based on the 1002 * record length of the info record. 1003 */ 1004 1005 cnt = sizeof(struct hfa384x_comm_tallies_32) / sizeof(u32); 1006 if (inf->framelen > 22) { 1007 dst = (u32 *)&hw->tallies; 1008 src32 = (u32 *)&inf->info.commtallies32; 1009 for (i = 0; i < cnt; i++, dst++, src32++) 1010 *dst += le32_to_cpu(*src32); 1011 } else { 1012 dst = (u32 *)&hw->tallies; 1013 src16 = (u16 *)&inf->info.commtallies16; 1014 for (i = 0; i < cnt; i++, dst++, src16++) 1015 *dst += le16_to_cpu(*src16); 1016 } 1017} 1018 1019/* 1020 * prism2sta_inf_scanresults 1021 * 1022 * Handles the receipt of a Scan Results info frame. 1023 * 1024 * Arguments: 1025 * wlandev wlan device structure 1026 * inf ptr to info frame (contents in hfa384x order) 1027 * 1028 * Returns: 1029 * nothing 1030 * 1031 * Side effects: 1032 * 1033 * Call context: 1034 * interrupt 1035 */ 1036static void prism2sta_inf_scanresults(struct wlandevice *wlandev, 1037 struct hfa384x_inf_frame *inf) 1038{ 1039 struct hfa384x *hw = wlandev->priv; 1040 int nbss; 1041 struct hfa384x_scan_result *sr = &inf->info.scanresult; 1042 int i; 1043 struct hfa384x_join_request_data joinreq; 1044 int result; 1045 1046 /* Get the number of results, first in bytes, then in results */ 1047 nbss = (inf->framelen * sizeof(u16)) - 1048 sizeof(inf->infotype) - sizeof(inf->info.scanresult.scanreason); 1049 nbss /= sizeof(struct hfa384x_scan_result_sub); 1050 1051 /* Print em */ 1052 pr_debug("rx scanresults, reason=%d, nbss=%d:\n", 1053 inf->info.scanresult.scanreason, nbss); 1054 for (i = 0; i < nbss; i++) { 1055 pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n", 1056 sr->result[i].chid, 1057 sr->result[i].anl, 1058 sr->result[i].sl, sr->result[i].bcnint); 1059 pr_debug(" capinfo=0x%04x proberesp_rate=%d\n", 1060 sr->result[i].capinfo, sr->result[i].proberesp_rate); 1061 } 1062 /* issue a join request */ 1063 joinreq.channel = sr->result[0].chid; 1064 memcpy(joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN); 1065 result = hfa384x_drvr_setconfig(hw, 1066 HFA384x_RID_JOINREQUEST, 1067 &joinreq, HFA384x_RID_JOINREQUEST_LEN); 1068 if (result) { 1069 netdev_err(wlandev->netdev, "setconfig(joinreq) failed, result=%d\n", 1070 result); 1071 } 1072} 1073 1074/* 1075 * prism2sta_inf_hostscanresults 1076 * 1077 * Handles the receipt of a Scan Results info frame. 1078 * 1079 * Arguments: 1080 * wlandev wlan device structure 1081 * inf ptr to info frame (contents in hfa384x order) 1082 * 1083 * Returns: 1084 * nothing 1085 * 1086 * Side effects: 1087 * 1088 * Call context: 1089 * interrupt 1090 */ 1091static void prism2sta_inf_hostscanresults(struct wlandevice *wlandev, 1092 struct hfa384x_inf_frame *inf) 1093{ 1094 struct hfa384x *hw = wlandev->priv; 1095 int nbss; 1096 1097 nbss = (inf->framelen - 3) / 32; 1098 pr_debug("Received %d hostscan results\n", nbss); 1099 1100 if (nbss > 32) 1101 nbss = 32; 1102 1103 kfree(hw->scanresults); 1104 1105 hw->scanresults = kmemdup(inf, sizeof(*inf), GFP_ATOMIC); 1106 1107 if (nbss == 0) 1108 nbss = -1; 1109 1110 /* Notify/wake the sleeping caller. */ 1111 hw->scanflag = nbss; 1112 wake_up_interruptible(&hw->cmdq); 1113}; 1114 1115/* 1116 * prism2sta_inf_chinforesults 1117 * 1118 * Handles the receipt of a Channel Info Results info frame. 1119 * 1120 * Arguments: 1121 * wlandev wlan device structure 1122 * inf ptr to info frame (contents in hfa384x order) 1123 * 1124 * Returns: 1125 * nothing 1126 * 1127 * Side effects: 1128 * 1129 * Call context: 1130 * interrupt 1131 */ 1132static void prism2sta_inf_chinforesults(struct wlandevice *wlandev, 1133 struct hfa384x_inf_frame *inf) 1134{ 1135 struct hfa384x *hw = wlandev->priv; 1136 unsigned int i, n; 1137 1138 hw->channel_info.results.scanchannels = 1139 le16_to_cpu(inf->info.chinforesult.scanchannels); 1140 1141 for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) { 1142 struct hfa384x_ch_info_result_sub *result; 1143 struct hfa384x_ch_info_result_sub *chinforesult; 1144 int chan; 1145 1146 if (!(hw->channel_info.results.scanchannels & (1 << i))) 1147 continue; 1148 1149 result = &inf->info.chinforesult.result[n]; 1150 chan = le16_to_cpu(result->chid) - 1; 1151 1152 if (chan < 0 || chan >= HFA384x_CHINFORESULT_MAX) 1153 continue; 1154 1155 chinforesult = &hw->channel_info.results.result[chan]; 1156 chinforesult->chid = chan; 1157 chinforesult->anl = le16_to_cpu(result->anl); 1158 chinforesult->pnl = le16_to_cpu(result->pnl); 1159 chinforesult->active = le16_to_cpu(result->active); 1160 1161 pr_debug("chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n", 1162 chan + 1, 1163 (chinforesult->active & HFA384x_CHINFORESULT_BSSACTIVE) 1164 ? "signal" : "noise", 1165 chinforesult->anl, chinforesult->pnl, 1166 (chinforesult->active & HFA384x_CHINFORESULT_PCFACTIVE) 1167 ? 1 : 0); 1168 n++; 1169 } 1170 atomic_set(&hw->channel_info.done, 2); 1171 1172 hw->channel_info.count = n; 1173} 1174 1175void prism2sta_processing_defer(struct work_struct *data) 1176{ 1177 struct hfa384x *hw = container_of(data, struct hfa384x, link_bh); 1178 struct wlandevice *wlandev = hw->wlandev; 1179 struct hfa384x_bytestr32 ssid; 1180 int result; 1181 1182 /* First let's process the auth frames */ 1183 { 1184 struct sk_buff *skb; 1185 struct hfa384x_inf_frame *inf; 1186 1187 while ((skb = skb_dequeue(&hw->authq))) { 1188 inf = (struct hfa384x_inf_frame *)skb->data; 1189 prism2sta_inf_authreq_defer(wlandev, inf); 1190 } 1191 1192 } 1193 1194 /* Now let's handle the linkstatus stuff */ 1195 if (hw->link_status == hw->link_status_new) 1196 return; 1197 1198 hw->link_status = hw->link_status_new; 1199 1200 switch (hw->link_status) { 1201 case HFA384x_LINK_NOTCONNECTED: 1202 /* I'm currently assuming that this is the initial link 1203 * state. It should only be possible immediately 1204 * following an Enable command. 1205 * Response: 1206 * Block Transmits, Ignore receives of data frames 1207 */ 1208 netif_carrier_off(wlandev->netdev); 1209 1210 netdev_info(wlandev->netdev, "linkstatus=NOTCONNECTED (unhandled)\n"); 1211 break; 1212 1213 case HFA384x_LINK_CONNECTED: 1214 /* This one indicates a successful scan/join/auth/assoc. 1215 * When we have the full MLME complement, this event will 1216 * signify successful completion of both mlme_authenticate 1217 * and mlme_associate. State management will get a little 1218 * ugly here. 1219 * Response: 1220 * Indicate authentication and/or association 1221 * Enable Transmits, Receives and pass up data frames 1222 */ 1223 1224 netif_carrier_on(wlandev->netdev); 1225 1226 /* If we are joining a specific AP, set our 1227 * state and reset retries 1228 */ 1229 if (hw->join_ap == 1) 1230 hw->join_ap = 2; 1231 hw->join_retries = 60; 1232 1233 /* Don't call this in monitor mode */ 1234 if (wlandev->netdev->type == ARPHRD_ETHER) { 1235 u16 portstatus; 1236 1237 netdev_info(wlandev->netdev, "linkstatus=CONNECTED\n"); 1238 1239 /* For non-usb devices, we can use the sync versions */ 1240 /* Collect the BSSID, and set state to allow tx */ 1241 1242 result = hfa384x_drvr_getconfig(hw, 1243 HFA384x_RID_CURRENTBSSID, 1244 wlandev->bssid, 1245 WLAN_BSSID_LEN); 1246 if (result) { 1247 pr_debug 1248 ("getconfig(0x%02x) failed, result = %d\n", 1249 HFA384x_RID_CURRENTBSSID, result); 1250 return; 1251 } 1252 1253 result = hfa384x_drvr_getconfig(hw, 1254 HFA384x_RID_CURRENTSSID, 1255 &ssid, sizeof(ssid)); 1256 if (result) { 1257 pr_debug 1258 ("getconfig(0x%02x) failed, result = %d\n", 1259 HFA384x_RID_CURRENTSSID, result); 1260 return; 1261 } 1262 prism2mgmt_bytestr2pstr( 1263 (struct hfa384x_bytestr *)&ssid, 1264 (struct p80211pstrd *)&wlandev->ssid); 1265 1266 /* Collect the port status */ 1267 result = hfa384x_drvr_getconfig16(hw, 1268 HFA384x_RID_PORTSTATUS, 1269 &portstatus); 1270 if (result) { 1271 pr_debug 1272 ("getconfig(0x%02x) failed, result = %d\n", 1273 HFA384x_RID_PORTSTATUS, result); 1274 return; 1275 } 1276 wlandev->macmode = 1277 (portstatus == HFA384x_PSTATUS_CONN_IBSS) ? 1278 WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA; 1279 1280 /* signal back up to cfg80211 layer */ 1281 prism2_connect_result(wlandev, P80211ENUM_truth_false); 1282 1283 /* Get the ball rolling on the comms quality stuff */ 1284 prism2sta_commsqual_defer(&hw->commsqual_bh); 1285 } 1286 break; 1287 1288 case HFA384x_LINK_DISCONNECTED: 1289 /* This one indicates that our association is gone. We've 1290 * lost connection with the AP and/or been disassociated. 1291 * This indicates that the MAC has completely cleared it's 1292 * associated state. We * should send a deauth indication 1293 * (implying disassoc) up * to the MLME. 1294 * Response: 1295 * Indicate Deauthentication 1296 * Block Transmits, Ignore receives of data frames 1297 */ 1298 if (wlandev->netdev->type == ARPHRD_ETHER) 1299 netdev_info(wlandev->netdev, 1300 "linkstatus=DISCONNECTED (unhandled)\n"); 1301 wlandev->macmode = WLAN_MACMODE_NONE; 1302 1303 netif_carrier_off(wlandev->netdev); 1304 1305 /* signal back up to cfg80211 layer */ 1306 prism2_disconnected(wlandev); 1307 1308 break; 1309 1310 case HFA384x_LINK_AP_CHANGE: 1311 /* This one indicates that the MAC has decided to and 1312 * successfully completed a change to another AP. We 1313 * should probably implement a reassociation indication 1314 * in response to this one. I'm thinking that the 1315 * p80211 layer needs to be notified in case of 1316 * buffering/queueing issues. User mode also needs to be 1317 * notified so that any BSS dependent elements can be 1318 * updated. 1319 * associated state. We * should send a deauth indication 1320 * (implying disassoc) up * to the MLME. 1321 * Response: 1322 * Indicate Reassociation 1323 * Enable Transmits, Receives and pass up data frames 1324 */ 1325 netdev_info(wlandev->netdev, "linkstatus=AP_CHANGE\n"); 1326 1327 result = hfa384x_drvr_getconfig(hw, 1328 HFA384x_RID_CURRENTBSSID, 1329 wlandev->bssid, WLAN_BSSID_LEN); 1330 if (result) { 1331 pr_debug("getconfig(0x%02x) failed, result = %d\n", 1332 HFA384x_RID_CURRENTBSSID, result); 1333 return; 1334 } 1335 1336 result = hfa384x_drvr_getconfig(hw, 1337 HFA384x_RID_CURRENTSSID, 1338 &ssid, sizeof(ssid)); 1339 if (result) { 1340 pr_debug("getconfig(0x%02x) failed, result = %d\n", 1341 HFA384x_RID_CURRENTSSID, result); 1342 return; 1343 } 1344 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *)&ssid, 1345 (struct p80211pstrd *)&wlandev->ssid); 1346 1347 hw->link_status = HFA384x_LINK_CONNECTED; 1348 netif_carrier_on(wlandev->netdev); 1349 1350 /* signal back up to cfg80211 layer */ 1351 prism2_roamed(wlandev); 1352 1353 break; 1354 1355 case HFA384x_LINK_AP_OUTOFRANGE: 1356 /* This one indicates that the MAC has decided that the 1357 * AP is out of range, but hasn't found a better candidate 1358 * so the MAC maintains its "associated" state in case 1359 * we get back in range. We should block transmits and 1360 * receives in this state. Do we need an indication here? 1361 * Probably not since a polling user-mode element would 1362 * get this status from from p2PortStatus(FD40). What about 1363 * p80211? 1364 * Response: 1365 * Block Transmits, Ignore receives of data frames 1366 */ 1367 netdev_info(wlandev->netdev, "linkstatus=AP_OUTOFRANGE (unhandled)\n"); 1368 1369 netif_carrier_off(wlandev->netdev); 1370 1371 break; 1372 1373 case HFA384x_LINK_AP_INRANGE: 1374 /* This one indicates that the MAC has decided that the 1375 * AP is back in range. We continue working with our 1376 * existing association. 1377 * Response: 1378 * Enable Transmits, Receives and pass up data frames 1379 */ 1380 netdev_info(wlandev->netdev, "linkstatus=AP_INRANGE\n"); 1381 1382 hw->link_status = HFA384x_LINK_CONNECTED; 1383 netif_carrier_on(wlandev->netdev); 1384 1385 break; 1386 1387 case HFA384x_LINK_ASSOCFAIL: 1388 /* This one is actually a peer to CONNECTED. We've 1389 * requested a join for a given SSID and optionally BSSID. 1390 * We can use this one to indicate authentication and 1391 * association failures. The trick is going to be 1392 * 1) identifying the failure, and 2) state management. 1393 * Response: 1394 * Disable Transmits, Ignore receives of data frames 1395 */ 1396 if (hw->join_ap && --hw->join_retries > 0) { 1397 struct hfa384x_join_request_data joinreq; 1398 1399 joinreq = hw->joinreq; 1400 /* Send the join request */ 1401 hfa384x_drvr_setconfig(hw, 1402 HFA384x_RID_JOINREQUEST, 1403 &joinreq, 1404 HFA384x_RID_JOINREQUEST_LEN); 1405 netdev_info(wlandev->netdev, 1406 "linkstatus=ASSOCFAIL (re-submitting join)\n"); 1407 } else { 1408 netdev_info(wlandev->netdev, "linkstatus=ASSOCFAIL (unhandled)\n"); 1409 } 1410 1411 netif_carrier_off(wlandev->netdev); 1412 1413 /* signal back up to cfg80211 layer */ 1414 prism2_connect_result(wlandev, P80211ENUM_truth_true); 1415 1416 break; 1417 1418 default: 1419 /* This is bad, IO port problems? */ 1420 netdev_warn(wlandev->netdev, 1421 "unknown linkstatus=0x%02x\n", hw->link_status); 1422 return; 1423 } 1424 1425 wlandev->linkstatus = (hw->link_status == HFA384x_LINK_CONNECTED); 1426} 1427 1428/* 1429 * prism2sta_inf_linkstatus 1430 * 1431 * Handles the receipt of a Link Status info frame. 1432 * 1433 * Arguments: 1434 * wlandev wlan device structure 1435 * inf ptr to info frame (contents in hfa384x order) 1436 * 1437 * Returns: 1438 * nothing 1439 * 1440 * Side effects: 1441 * 1442 * Call context: 1443 * interrupt 1444 */ 1445static void prism2sta_inf_linkstatus(struct wlandevice *wlandev, 1446 struct hfa384x_inf_frame *inf) 1447{ 1448 struct hfa384x *hw = wlandev->priv; 1449 1450 hw->link_status_new = le16_to_cpu(inf->info.linkstatus.linkstatus); 1451 1452 schedule_work(&hw->link_bh); 1453} 1454 1455/* 1456 * prism2sta_inf_assocstatus 1457 * 1458 * Handles the receipt of an Association Status info frame. Should 1459 * be present in APs only. 1460 * 1461 * Arguments: 1462 * wlandev wlan device structure 1463 * inf ptr to info frame (contents in hfa384x order) 1464 * 1465 * Returns: 1466 * nothing 1467 * 1468 * Side effects: 1469 * 1470 * Call context: 1471 * interrupt 1472 */ 1473static void prism2sta_inf_assocstatus(struct wlandevice *wlandev, 1474 struct hfa384x_inf_frame *inf) 1475{ 1476 struct hfa384x *hw = wlandev->priv; 1477 struct hfa384x_assoc_status rec; 1478 int i; 1479 1480 memcpy(&rec, &inf->info.assocstatus, sizeof(rec)); 1481 le16_to_cpus(&rec.assocstatus); 1482 le16_to_cpus(&rec.reason); 1483 1484 /* 1485 * Find the address in the list of authenticated stations. 1486 * If it wasn't found, then this address has not been previously 1487 * authenticated and something weird has happened if this is 1488 * anything other than an "authentication failed" message. 1489 * If the address was found, then set the "associated" flag for 1490 * that station, based on whether the station is associating or 1491 * losing its association. Something weird has also happened 1492 * if we find the address in the list of authenticated stations 1493 * but we are getting an "authentication failed" message. 1494 */ 1495 1496 for (i = 0; i < hw->authlist.cnt; i++) 1497 if (ether_addr_equal(rec.sta_addr, hw->authlist.addr[i])) 1498 break; 1499 1500 if (i >= hw->authlist.cnt) { 1501 if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL) 1502 netdev_warn(wlandev->netdev, 1503 "assocstatus info frame received for non-authenticated station.\n"); 1504 } else { 1505 hw->authlist.assoc[i] = 1506 (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC || 1507 rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC); 1508 1509 if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL) 1510 netdev_warn(wlandev->netdev, 1511"authfail assocstatus info frame received for authenticated station.\n"); 1512 } 1513} 1514 1515/* 1516 * prism2sta_inf_authreq 1517 * 1518 * Handles the receipt of an Authentication Request info frame. Should 1519 * be present in APs only. 1520 * 1521 * Arguments: 1522 * wlandev wlan device structure 1523 * inf ptr to info frame (contents in hfa384x order) 1524 * 1525 * Returns: 1526 * nothing 1527 * 1528 * Side effects: 1529 * 1530 * Call context: 1531 * interrupt 1532 * 1533 */ 1534static void prism2sta_inf_authreq(struct wlandevice *wlandev, 1535 struct hfa384x_inf_frame *inf) 1536{ 1537 struct hfa384x *hw = wlandev->priv; 1538 struct sk_buff *skb; 1539 1540 skb = dev_alloc_skb(sizeof(*inf)); 1541 if (skb) { 1542 skb_put(skb, sizeof(*inf)); 1543 memcpy(skb->data, inf, sizeof(*inf)); 1544 skb_queue_tail(&hw->authq, skb); 1545 schedule_work(&hw->link_bh); 1546 } 1547} 1548 1549static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev, 1550 struct hfa384x_inf_frame *inf) 1551{ 1552 struct hfa384x *hw = wlandev->priv; 1553 struct hfa384x_authenticate_station_data rec; 1554 1555 int i, added, result, cnt; 1556 u8 *addr; 1557 1558 /* 1559 * Build the AuthenticateStation record. Initialize it for denying 1560 * authentication. 1561 */ 1562 1563 ether_addr_copy(rec.address, inf->info.authreq.sta_addr); 1564 rec.status = P80211ENUM_status_unspec_failure; 1565 1566 /* 1567 * Authenticate based on the access mode. 1568 */ 1569 1570 switch (hw->accessmode) { 1571 case WLAN_ACCESS_NONE: 1572 1573 /* 1574 * Deny all new authentications. However, if a station 1575 * is ALREADY authenticated, then accept it. 1576 */ 1577 1578 for (i = 0; i < hw->authlist.cnt; i++) 1579 if (ether_addr_equal(rec.address, 1580 hw->authlist.addr[i])) { 1581 rec.status = P80211ENUM_status_successful; 1582 break; 1583 } 1584 1585 break; 1586 1587 case WLAN_ACCESS_ALL: 1588 1589 /* 1590 * Allow all authentications. 1591 */ 1592 1593 rec.status = P80211ENUM_status_successful; 1594 break; 1595 1596 case WLAN_ACCESS_ALLOW: 1597 1598 /* 1599 * Only allow the authentication if the MAC address 1600 * is in the list of allowed addresses. 1601 * 1602 * Since this is the interrupt handler, we may be here 1603 * while the access list is in the middle of being 1604 * updated. Choose the list which is currently okay. 1605 * See "prism2mib_priv_accessallow()" for details. 1606 */ 1607 1608 if (hw->allow.modify == 0) { 1609 cnt = hw->allow.cnt; 1610 addr = hw->allow.addr[0]; 1611 } else { 1612 cnt = hw->allow.cnt1; 1613 addr = hw->allow.addr1[0]; 1614 } 1615 1616 for (i = 0; i < cnt; i++, addr += ETH_ALEN) 1617 if (ether_addr_equal(rec.address, addr)) { 1618 rec.status = P80211ENUM_status_successful; 1619 break; 1620 } 1621 1622 break; 1623 1624 case WLAN_ACCESS_DENY: 1625 1626 /* 1627 * Allow the authentication UNLESS the MAC address is 1628 * in the list of denied addresses. 1629 * 1630 * Since this is the interrupt handler, we may be here 1631 * while the access list is in the middle of being 1632 * updated. Choose the list which is currently okay. 1633 * See "prism2mib_priv_accessdeny()" for details. 1634 */ 1635 1636 if (hw->deny.modify == 0) { 1637 cnt = hw->deny.cnt; 1638 addr = hw->deny.addr[0]; 1639 } else { 1640 cnt = hw->deny.cnt1; 1641 addr = hw->deny.addr1[0]; 1642 } 1643 1644 rec.status = P80211ENUM_status_successful; 1645 1646 for (i = 0; i < cnt; i++, addr += ETH_ALEN) 1647 if (ether_addr_equal(rec.address, addr)) { 1648 rec.status = P80211ENUM_status_unspec_failure; 1649 break; 1650 } 1651 1652 break; 1653 } 1654 1655 /* 1656 * If the authentication is okay, then add the MAC address to the 1657 * list of authenticated stations. Don't add the address if it 1658 * is already in the list. (802.11b does not seem to disallow 1659 * a station from issuing an authentication request when the 1660 * station is already authenticated. Does this sort of thing 1661 * ever happen? We might as well do the check just in case.) 1662 */ 1663 1664 added = 0; 1665 1666 if (rec.status == P80211ENUM_status_successful) { 1667 for (i = 0; i < hw->authlist.cnt; i++) 1668 if (ether_addr_equal(rec.address, 1669 hw->authlist.addr[i])) 1670 break; 1671 1672 if (i >= hw->authlist.cnt) { 1673 if (hw->authlist.cnt >= WLAN_AUTH_MAX) { 1674 rec.status = P80211ENUM_status_ap_full; 1675 } else { 1676 ether_addr_copy( 1677 hw->authlist.addr[hw->authlist.cnt], 1678 rec.address); 1679 hw->authlist.cnt++; 1680 added = 1; 1681 } 1682 } 1683 } 1684 1685 /* 1686 * Send back the results of the authentication. If this doesn't work, 1687 * then make sure to remove the address from the authenticated list if 1688 * it was added. 1689 */ 1690 1691 rec.status = cpu_to_le16(rec.status); 1692 rec.algorithm = inf->info.authreq.algorithm; 1693 1694 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA, 1695 &rec, sizeof(rec)); 1696 if (result) { 1697 if (added) 1698 hw->authlist.cnt--; 1699 netdev_err(wlandev->netdev, 1700 "setconfig(authenticatestation) failed, result=%d\n", 1701 result); 1702 } 1703} 1704 1705/* 1706 * prism2sta_inf_psusercnt 1707 * 1708 * Handles the receipt of a PowerSaveUserCount info frame. Should 1709 * be present in APs only. 1710 * 1711 * Arguments: 1712 * wlandev wlan device structure 1713 * inf ptr to info frame (contents in hfa384x order) 1714 * 1715 * Returns: 1716 * nothing 1717 * 1718 * Side effects: 1719 * 1720 * Call context: 1721 * interrupt 1722 */ 1723static void prism2sta_inf_psusercnt(struct wlandevice *wlandev, 1724 struct hfa384x_inf_frame *inf) 1725{ 1726 struct hfa384x *hw = wlandev->priv; 1727 1728 hw->psusercount = le16_to_cpu(inf->info.psusercnt.usercnt); 1729} 1730 1731/* 1732 * prism2sta_ev_info 1733 * 1734 * Handles the Info event. 1735 * 1736 * Arguments: 1737 * wlandev wlan device structure 1738 * inf ptr to a generic info frame 1739 * 1740 * Returns: 1741 * nothing 1742 * 1743 * Side effects: 1744 * 1745 * Call context: 1746 * interrupt 1747 */ 1748void prism2sta_ev_info(struct wlandevice *wlandev, 1749 struct hfa384x_inf_frame *inf) 1750{ 1751 le16_to_cpus(&inf->infotype); 1752 /* Dispatch */ 1753 switch (inf->infotype) { 1754 case HFA384x_IT_HANDOVERADDR: 1755 prism2sta_inf_handover(wlandev, inf); 1756 break; 1757 case HFA384x_IT_COMMTALLIES: 1758 prism2sta_inf_tallies(wlandev, inf); 1759 break; 1760 case HFA384x_IT_HOSTSCANRESULTS: 1761 prism2sta_inf_hostscanresults(wlandev, inf); 1762 break; 1763 case HFA384x_IT_SCANRESULTS: 1764 prism2sta_inf_scanresults(wlandev, inf); 1765 break; 1766 case HFA384x_IT_CHINFORESULTS: 1767 prism2sta_inf_chinforesults(wlandev, inf); 1768 break; 1769 case HFA384x_IT_LINKSTATUS: 1770 prism2sta_inf_linkstatus(wlandev, inf); 1771 break; 1772 case HFA384x_IT_ASSOCSTATUS: 1773 prism2sta_inf_assocstatus(wlandev, inf); 1774 break; 1775 case HFA384x_IT_AUTHREQ: 1776 prism2sta_inf_authreq(wlandev, inf); 1777 break; 1778 case HFA384x_IT_PSUSERCNT: 1779 prism2sta_inf_psusercnt(wlandev, inf); 1780 break; 1781 case HFA384x_IT_KEYIDCHANGED: 1782 netdev_warn(wlandev->netdev, "Unhandled IT_KEYIDCHANGED\n"); 1783 break; 1784 case HFA384x_IT_ASSOCREQ: 1785 netdev_warn(wlandev->netdev, "Unhandled IT_ASSOCREQ\n"); 1786 break; 1787 case HFA384x_IT_MICFAILURE: 1788 netdev_warn(wlandev->netdev, "Unhandled IT_MICFAILURE\n"); 1789 break; 1790 default: 1791 netdev_warn(wlandev->netdev, 1792 "Unknown info type=0x%02x\n", inf->infotype); 1793 break; 1794 } 1795} 1796 1797/* 1798 * prism2sta_ev_txexc 1799 * 1800 * Handles the TxExc event. A Transmit Exception event indicates 1801 * that the MAC's TX process was unsuccessful - so the packet did 1802 * not get transmitted. 1803 * 1804 * Arguments: 1805 * wlandev wlan device structure 1806 * status tx frame status word 1807 * 1808 * Returns: 1809 * nothing 1810 * 1811 * Side effects: 1812 * 1813 * Call context: 1814 * interrupt 1815 */ 1816void prism2sta_ev_txexc(struct wlandevice *wlandev, u16 status) 1817{ 1818 pr_debug("TxExc status=0x%x.\n", status); 1819} 1820 1821/* 1822 * prism2sta_ev_tx 1823 * 1824 * Handles the Tx event. 1825 * 1826 * Arguments: 1827 * wlandev wlan device structure 1828 * status tx frame status word 1829 * Returns: 1830 * nothing 1831 * 1832 * Side effects: 1833 * 1834 * Call context: 1835 * interrupt 1836 */ 1837void prism2sta_ev_tx(struct wlandevice *wlandev, u16 status) 1838{ 1839 pr_debug("Tx Complete, status=0x%04x\n", status); 1840 /* update linux network stats */ 1841 wlandev->netdev->stats.tx_packets++; 1842} 1843 1844/* 1845 * prism2sta_ev_alloc 1846 * 1847 * Handles the Alloc event. 1848 * 1849 * Arguments: 1850 * wlandev wlan device structure 1851 * 1852 * Returns: 1853 * nothing 1854 * 1855 * Side effects: 1856 * 1857 * Call context: 1858 * interrupt 1859 */ 1860void prism2sta_ev_alloc(struct wlandevice *wlandev) 1861{ 1862 netif_wake_queue(wlandev->netdev); 1863} 1864 1865/* 1866 * create_wlan 1867 * 1868 * Called at module init time. This creates the struct wlandevice structure 1869 * and initializes it with relevant bits. 1870 * 1871 * Arguments: 1872 * none 1873 * 1874 * Returns: 1875 * the created struct wlandevice structure. 1876 * 1877 * Side effects: 1878 * also allocates the priv/hw structures. 1879 * 1880 * Call context: 1881 * process thread 1882 * 1883 */ 1884static struct wlandevice *create_wlan(void) 1885{ 1886 struct wlandevice *wlandev = NULL; 1887 struct hfa384x *hw = NULL; 1888 1889 /* Alloc our structures */ 1890 wlandev = kzalloc(sizeof(*wlandev), GFP_KERNEL); 1891 hw = kzalloc(sizeof(*hw), GFP_KERNEL); 1892 1893 if (!wlandev || !hw) { 1894 kfree(wlandev); 1895 kfree(hw); 1896 return NULL; 1897 } 1898 1899 /* Initialize the network device object. */ 1900 wlandev->nsdname = dev_info; 1901 wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING; 1902 wlandev->priv = hw; 1903 wlandev->open = prism2sta_open; 1904 wlandev->close = prism2sta_close; 1905 wlandev->reset = prism2sta_reset; 1906 wlandev->txframe = prism2sta_txframe; 1907 wlandev->mlmerequest = prism2sta_mlmerequest; 1908 wlandev->set_multicast_list = prism2sta_setmulticast; 1909 wlandev->tx_timeout = hfa384x_tx_timeout; 1910 1911 wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | P80211_NSDCAP_AUTOJOIN; 1912 1913 /* Initialize the device private data structure. */ 1914 hw->dot11_desired_bss_type = 1; 1915 1916 return wlandev; 1917} 1918 1919void prism2sta_commsqual_defer(struct work_struct *data) 1920{ 1921 struct hfa384x *hw = container_of(data, struct hfa384x, commsqual_bh); 1922 struct wlandevice *wlandev = hw->wlandev; 1923 struct hfa384x_bytestr32 ssid; 1924 struct p80211msg_dot11req_mibget msg; 1925 struct p80211item_uint32 *mibitem = (struct p80211item_uint32 *) 1926 &msg.mibattribute.data; 1927 int result = 0; 1928 1929 if (hw->wlandev->hwremoved) 1930 return; 1931 1932 /* we don't care if we're in AP mode */ 1933 if ((wlandev->macmode == WLAN_MACMODE_NONE) || 1934 (wlandev->macmode == WLAN_MACMODE_ESS_AP)) { 1935 return; 1936 } 1937 1938 /* It only makes sense to poll these in non-IBSS */ 1939 if (wlandev->macmode != WLAN_MACMODE_IBSS_STA) { 1940 result = hfa384x_drvr_getconfig( 1941 hw, HFA384x_RID_DBMCOMMSQUALITY, 1942 &hw->qual, HFA384x_RID_DBMCOMMSQUALITY_LEN); 1943 1944 if (result) { 1945 netdev_err(wlandev->netdev, "error fetching commsqual\n"); 1946 return; 1947 } 1948 1949 pr_debug("commsqual %d %d %d\n", 1950 le16_to_cpu(hw->qual.cq_curr_bss), 1951 le16_to_cpu(hw->qual.asl_curr_bss), 1952 le16_to_cpu(hw->qual.anl_curr_fc)); 1953 } 1954 1955 /* Get the signal rate */ 1956 msg.msgcode = DIDmsg_dot11req_mibget; 1957 mibitem->did = DIDmib_p2_p2MAC_p2CurrentTxRate; 1958 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1959 1960 if (result) { 1961 pr_debug("get signal rate failed, result = %d\n", 1962 result); 1963 return; 1964 } 1965 1966 switch (mibitem->data) { 1967 case HFA384x_RATEBIT_1: 1968 hw->txrate = 10; 1969 break; 1970 case HFA384x_RATEBIT_2: 1971 hw->txrate = 20; 1972 break; 1973 case HFA384x_RATEBIT_5dot5: 1974 hw->txrate = 55; 1975 break; 1976 case HFA384x_RATEBIT_11: 1977 hw->txrate = 110; 1978 break; 1979 default: 1980 pr_debug("Bad ratebit (%d)\n", mibitem->data); 1981 } 1982 1983 /* Lastly, we need to make sure the BSSID didn't change on us */ 1984 result = hfa384x_drvr_getconfig(hw, 1985 HFA384x_RID_CURRENTBSSID, 1986 wlandev->bssid, WLAN_BSSID_LEN); 1987 if (result) { 1988 pr_debug("getconfig(0x%02x) failed, result = %d\n", 1989 HFA384x_RID_CURRENTBSSID, result); 1990 return; 1991 } 1992 1993 result = hfa384x_drvr_getconfig(hw, 1994 HFA384x_RID_CURRENTSSID, 1995 &ssid, sizeof(ssid)); 1996 if (result) { 1997 pr_debug("getconfig(0x%02x) failed, result = %d\n", 1998 HFA384x_RID_CURRENTSSID, result); 1999 return; 2000 } 2001 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *)&ssid, 2002 (struct p80211pstrd *)&wlandev->ssid); 2003 2004 /* Reschedule timer */ 2005 mod_timer(&hw->commsqual_timer, jiffies + HZ); 2006} 2007 2008void prism2sta_commsqual_timer(unsigned long data) 2009{ 2010 struct hfa384x *hw = (struct hfa384x *)data; 2011 2012 schedule_work(&hw->commsqual_bh); 2013}