PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / staging / wlan-ng / prism2sta.c
blob2199f5afbf903bde043bd7cb7fd17385c06c5568
1 /* src/prism2/driver/prism2sta.c
3 * Implements the station functionality for prism2
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
6 * --------------------------------------------------------------------
8 * linux-wlan
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/
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.
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.
31 * --------------------------------------------------------------------
33 * Inquiries regarding the linux-wlan Open Source project can be
34 * made directly to:
36 * AbsoluteValue Systems Inc.
37 * info@linux-wlan.com
38 * http://www.linux-wlan.com
40 * --------------------------------------------------------------------
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
45 * --------------------------------------------------------------------
47 * This file implements the module and linux pcmcia routines for the
48 * prism2 driver.
50 * --------------------------------------------------------------------
53 #include <linux/module.h>
54 #include <linux/moduleparam.h>
55 #include <linux/kernel.h>
56 #include <linux/sched.h>
57 #include <linux/types.h>
58 #include <linux/slab.h>
59 #include <linux/wireless.h>
60 #include <linux/netdevice.h>
61 #include <linux/workqueue.h>
62 #include <linux/byteorder/generic.h>
63 #include <linux/ctype.h>
65 #include <linux/io.h>
66 #include <linux/delay.h>
67 #include <asm/byteorder.h>
68 #include <linux/if_arp.h>
69 #include <linux/if_ether.h>
70 #include <linux/bitops.h>
72 #include "p80211types.h"
73 #include "p80211hdr.h"
74 #include "p80211mgmt.h"
75 #include "p80211conv.h"
76 #include "p80211msg.h"
77 #include "p80211netdev.h"
78 #include "p80211req.h"
79 #include "p80211metadef.h"
80 #include "p80211metastruct.h"
81 #include "hfa384x.h"
82 #include "prism2mgmt.h"
84 /* Create a string of printable chars from something that might not be */
85 /* It's recommended that the str be 4*len + 1 bytes long */
86 #define wlan_mkprintstr(buf, buflen, str, strlen) \
87 { \
88 int i = 0; \
89 int j = 0; \
90 memset(str, 0, (strlen)); \
91 for (i = 0; i < (buflen); i++) { \
92 if (isprint((buf)[i])) { \
93 (str)[j] = (buf)[i]; \
94 j++; \
95 } else { \
96 (str)[j] = '\\'; \
97 (str)[j+1] = 'x'; \
98 (str)[j+2] = hex_asc_hi((buf)[i]); \
99 (str)[j+3] = hex_asc_lo((buf)[i]); \
100 j += 4; \
105 static char *dev_info = "prism2_usb";
106 static wlandevice_t *create_wlan(void);
108 int prism2_reset_holdtime = 30; /* Reset hold time in ms */
109 int prism2_reset_settletime = 100; /* Reset settle time in ms */
111 static int prism2_doreset; /* Do a reset at init? */
113 module_param(prism2_doreset, int, 0644);
114 MODULE_PARM_DESC(prism2_doreset, "Issue a reset on initialization");
116 module_param(prism2_reset_holdtime, int, 0644);
117 MODULE_PARM_DESC(prism2_reset_holdtime, "reset hold time in ms");
118 module_param(prism2_reset_settletime, int, 0644);
119 MODULE_PARM_DESC(prism2_reset_settletime, "reset settle time in ms");
121 MODULE_LICENSE("Dual MPL/GPL");
123 void prism2_connect_result(wlandevice_t *wlandev, u8 failed);
124 void prism2_disconnected(wlandevice_t *wlandev);
125 void prism2_roamed(wlandevice_t *wlandev);
127 static int prism2sta_open(wlandevice_t *wlandev);
128 static int prism2sta_close(wlandevice_t *wlandev);
129 static void prism2sta_reset(wlandevice_t *wlandev);
130 static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
131 union p80211_hdr *p80211_hdr,
132 struct p80211_metawep *p80211_wep);
133 static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg);
134 static int prism2sta_getcardinfo(wlandevice_t *wlandev);
135 static int prism2sta_globalsetup(wlandevice_t *wlandev);
136 static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev);
138 static void prism2sta_inf_handover(wlandevice_t *wlandev,
139 hfa384x_InfFrame_t *inf);
140 static void prism2sta_inf_tallies(wlandevice_t *wlandev,
141 hfa384x_InfFrame_t *inf);
142 static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
143 hfa384x_InfFrame_t *inf);
144 static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
145 hfa384x_InfFrame_t *inf);
146 static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
147 hfa384x_InfFrame_t *inf);
148 static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
149 hfa384x_InfFrame_t *inf);
150 static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
151 hfa384x_InfFrame_t *inf);
152 static void prism2sta_inf_authreq(wlandevice_t *wlandev,
153 hfa384x_InfFrame_t *inf);
154 static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
155 hfa384x_InfFrame_t *inf);
156 static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
157 hfa384x_InfFrame_t *inf);
159 /*----------------------------------------------------------------
160 * prism2sta_open
162 * WLAN device open method. Called from p80211netdev when kernel
163 * device open (start) method is called in response to the
164 * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP
165 * from clear to set.
167 * Arguments:
168 * wlandev wlan device structure
170 * Returns:
171 * 0 success
172 * >0 f/w reported error
173 * <0 driver reported error
175 * Side effects:
177 * Call context:
178 * process thread
179 ----------------------------------------------------------------*/
180 static int prism2sta_open(wlandevice_t *wlandev)
182 /* We don't currently have to do anything else.
183 * The setup of the MAC should be subsequently completed via
184 * the mlme commands.
185 * Higher layers know we're ready from dev->start==1 and
186 * dev->tbusy==0. Our rx path knows to pass up received/
187 * frames because of dev->flags&IFF_UP is true.
190 return 0;
193 /*----------------------------------------------------------------
194 * prism2sta_close
196 * WLAN device close method. Called from p80211netdev when kernel
197 * device close method is called in response to the
198 * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP
199 * from set to clear.
201 * Arguments:
202 * wlandev wlan device structure
204 * Returns:
205 * 0 success
206 * >0 f/w reported error
207 * <0 driver reported error
209 * Side effects:
211 * Call context:
212 * process thread
213 ----------------------------------------------------------------*/
214 static int prism2sta_close(wlandevice_t *wlandev)
216 /* We don't currently have to do anything else.
217 * Higher layers know we're not ready from dev->start==0 and
218 * dev->tbusy==1. Our rx path knows to not pass up received
219 * frames because of dev->flags&IFF_UP is false.
222 return 0;
225 /*----------------------------------------------------------------
226 * prism2sta_reset
228 * Not currently implented.
230 * Arguments:
231 * wlandev wlan device structure
232 * none
234 * Returns:
235 * nothing
237 * Side effects:
239 * Call context:
240 * process thread
241 ----------------------------------------------------------------*/
242 static void prism2sta_reset(wlandevice_t *wlandev)
246 /*----------------------------------------------------------------
247 * prism2sta_txframe
249 * Takes a frame from p80211 and queues it for transmission.
251 * Arguments:
252 * wlandev wlan device structure
253 * pb packet buffer struct. Contains an 802.11
254 * data frame.
255 * p80211_hdr points to the 802.11 header for the packet.
256 * Returns:
257 * 0 Success and more buffs available
258 * 1 Success but no more buffs
259 * 2 Allocation failure
260 * 4 Buffer full or queue busy
262 * Side effects:
264 * Call context:
265 * process thread
266 ----------------------------------------------------------------*/
267 static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
268 union p80211_hdr *p80211_hdr,
269 struct p80211_metawep *p80211_wep)
271 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
272 int result;
274 /* If necessary, set the 802.11 WEP bit */
275 if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) ==
276 HOSTWEP_PRIVACYINVOKED) {
277 p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
280 result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep);
282 return result;
285 /*----------------------------------------------------------------
286 * prism2sta_mlmerequest
288 * wlan command message handler. All we do here is pass the message
289 * over to the prism2sta_mgmt_handler.
291 * Arguments:
292 * wlandev wlan device structure
293 * msg wlan command message
294 * Returns:
295 * 0 success
296 * <0 successful acceptance of message, but we're
297 * waiting for an async process to finish before
298 * we're done with the msg. When the asynch
299 * process is done, we'll call the p80211
300 * function p80211req_confirm() .
301 * >0 An error occurred while we were handling
302 * the message.
304 * Side effects:
306 * Call context:
307 * process thread
308 ----------------------------------------------------------------*/
309 static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg)
311 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
313 int result = 0;
315 switch (msg->msgcode) {
316 case DIDmsg_dot11req_mibget:
317 pr_debug("Received mibget request\n");
318 result = prism2mgmt_mibset_mibget(wlandev, msg);
319 break;
320 case DIDmsg_dot11req_mibset:
321 pr_debug("Received mibset request\n");
322 result = prism2mgmt_mibset_mibget(wlandev, msg);
323 break;
324 case DIDmsg_dot11req_scan:
325 pr_debug("Received scan request\n");
326 result = prism2mgmt_scan(wlandev, msg);
327 break;
328 case DIDmsg_dot11req_scan_results:
329 pr_debug("Received scan_results request\n");
330 result = prism2mgmt_scan_results(wlandev, msg);
331 break;
332 case DIDmsg_dot11req_start:
333 pr_debug("Received mlme start request\n");
334 result = prism2mgmt_start(wlandev, msg);
335 break;
337 * Prism2 specific messages
339 case DIDmsg_p2req_readpda:
340 pr_debug("Received mlme readpda request\n");
341 result = prism2mgmt_readpda(wlandev, msg);
342 break;
343 case DIDmsg_p2req_ramdl_state:
344 pr_debug("Received mlme ramdl_state request\n");
345 result = prism2mgmt_ramdl_state(wlandev, msg);
346 break;
347 case DIDmsg_p2req_ramdl_write:
348 pr_debug("Received mlme ramdl_write request\n");
349 result = prism2mgmt_ramdl_write(wlandev, msg);
350 break;
351 case DIDmsg_p2req_flashdl_state:
352 pr_debug("Received mlme flashdl_state request\n");
353 result = prism2mgmt_flashdl_state(wlandev, msg);
354 break;
355 case DIDmsg_p2req_flashdl_write:
356 pr_debug("Received mlme flashdl_write request\n");
357 result = prism2mgmt_flashdl_write(wlandev, msg);
358 break;
360 * Linux specific messages
362 case DIDmsg_lnxreq_hostwep:
363 break; /* ignore me. */
364 case DIDmsg_lnxreq_ifstate:
366 struct p80211msg_lnxreq_ifstate *ifstatemsg;
367 pr_debug("Received mlme ifstate request\n");
368 ifstatemsg = (struct p80211msg_lnxreq_ifstate *) msg;
369 result =
370 prism2sta_ifstate(wlandev,
371 ifstatemsg->ifstate.data);
372 ifstatemsg->resultcode.status =
373 P80211ENUM_msgitem_status_data_ok;
374 ifstatemsg->resultcode.data = result;
375 result = 0;
377 break;
378 case DIDmsg_lnxreq_wlansniff:
379 pr_debug("Received mlme wlansniff request\n");
380 result = prism2mgmt_wlansniff(wlandev, msg);
381 break;
382 case DIDmsg_lnxreq_autojoin:
383 pr_debug("Received mlme autojoin request\n");
384 result = prism2mgmt_autojoin(wlandev, msg);
385 break;
386 case DIDmsg_lnxreq_commsquality:{
387 struct p80211msg_lnxreq_commsquality *qualmsg;
389 pr_debug("Received commsquality request\n");
391 qualmsg = (struct p80211msg_lnxreq_commsquality *) msg;
393 qualmsg->link.status =
394 P80211ENUM_msgitem_status_data_ok;
395 qualmsg->level.status =
396 P80211ENUM_msgitem_status_data_ok;
397 qualmsg->noise.status =
398 P80211ENUM_msgitem_status_data_ok;
400 qualmsg->link.data = le16_to_cpu(hw->qual.CQ_currBSS);
401 qualmsg->level.data = le16_to_cpu(hw->qual.ASL_currBSS);
402 qualmsg->noise.data = le16_to_cpu(hw->qual.ANL_currFC);
403 qualmsg->txrate.data = hw->txrate;
405 break;
407 default:
408 printk(KERN_WARNING "Unknown mgmt request message 0x%08x",
409 msg->msgcode);
410 break;
413 return result;
416 /*----------------------------------------------------------------
417 * prism2sta_ifstate
419 * Interface state. This is the primary WLAN interface enable/disable
420 * handler. Following the driver/load/deviceprobe sequence, this
421 * function must be called with a state of "enable" before any other
422 * commands will be accepted.
424 * Arguments:
425 * wlandev wlan device structure
426 * msgp ptr to msg buffer
428 * Returns:
429 * A p80211 message resultcode value.
431 * Side effects:
433 * Call context:
434 * process thread (usually)
435 * interrupt
436 ----------------------------------------------------------------*/
437 u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
439 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
440 u32 result;
442 result = P80211ENUM_resultcode_implementation_failure;
444 pr_debug("Current MSD state(%d), requesting(%d)\n",
445 wlandev->msdstate, ifstate);
446 switch (ifstate) {
447 case P80211ENUM_ifstate_fwload:
448 switch (wlandev->msdstate) {
449 case WLAN_MSD_HWPRESENT:
450 wlandev->msdstate = WLAN_MSD_FWLOAD_PENDING;
452 * Initialize the device+driver sufficiently
453 * for firmware loading.
455 result = hfa384x_drvr_start(hw);
456 if (result) {
457 printk(KERN_ERR
458 "hfa384x_drvr_start() failed,"
459 "result=%d\n", (int)result);
460 result =
461 P80211ENUM_resultcode_implementation_failure;
462 wlandev->msdstate = WLAN_MSD_HWPRESENT;
463 break;
465 wlandev->msdstate = WLAN_MSD_FWLOAD;
466 result = P80211ENUM_resultcode_success;
467 break;
468 case WLAN_MSD_FWLOAD:
469 hfa384x_cmd_initialize(hw);
470 result = P80211ENUM_resultcode_success;
471 break;
472 case WLAN_MSD_RUNNING:
473 printk(KERN_WARNING
474 "Cannot enter fwload state from enable state,"
475 "you must disable first.\n");
476 result = P80211ENUM_resultcode_invalid_parameters;
477 break;
478 case WLAN_MSD_HWFAIL:
479 default:
480 /* probe() had a problem or the msdstate contains
481 * an unrecognized value, there's nothing we can do.
483 result = P80211ENUM_resultcode_implementation_failure;
484 break;
486 break;
487 case P80211ENUM_ifstate_enable:
488 switch (wlandev->msdstate) {
489 case WLAN_MSD_HWPRESENT:
490 case WLAN_MSD_FWLOAD:
491 wlandev->msdstate = WLAN_MSD_RUNNING_PENDING;
492 /* Initialize the device+driver for full
493 * operation. Note that this might me an FWLOAD to
494 * to RUNNING transition so we must not do a chip
495 * or board level reset. Note that on failure,
496 * the MSD state is set to HWPRESENT because we
497 * can't make any assumptions about the state
498 * of the hardware or a previous firmware load.
500 result = hfa384x_drvr_start(hw);
501 if (result) {
502 printk(KERN_ERR
503 "hfa384x_drvr_start() failed,"
504 "result=%d\n", (int)result);
505 result =
506 P80211ENUM_resultcode_implementation_failure;
507 wlandev->msdstate = WLAN_MSD_HWPRESENT;
508 break;
511 result = prism2sta_getcardinfo(wlandev);
512 if (result) {
513 printk(KERN_ERR
514 "prism2sta_getcardinfo() failed,"
515 "result=%d\n", (int)result);
516 result =
517 P80211ENUM_resultcode_implementation_failure;
518 hfa384x_drvr_stop(hw);
519 wlandev->msdstate = WLAN_MSD_HWPRESENT;
520 break;
522 result = prism2sta_globalsetup(wlandev);
523 if (result) {
524 printk(KERN_ERR
525 "prism2sta_globalsetup() failed,"
526 "result=%d\n", (int)result);
527 result =
528 P80211ENUM_resultcode_implementation_failure;
529 hfa384x_drvr_stop(hw);
530 wlandev->msdstate = WLAN_MSD_HWPRESENT;
531 break;
533 wlandev->msdstate = WLAN_MSD_RUNNING;
534 hw->join_ap = 0;
535 hw->join_retries = 60;
536 result = P80211ENUM_resultcode_success;
537 break;
538 case WLAN_MSD_RUNNING:
539 /* Do nothing, we're already in this state. */
540 result = P80211ENUM_resultcode_success;
541 break;
542 case WLAN_MSD_HWFAIL:
543 default:
544 /* probe() had a problem or the msdstate contains
545 * an unrecognized value, there's nothing we can do.
547 result = P80211ENUM_resultcode_implementation_failure;
548 break;
550 break;
551 case P80211ENUM_ifstate_disable:
552 switch (wlandev->msdstate) {
553 case WLAN_MSD_HWPRESENT:
554 /* Do nothing, we're already in this state. */
555 result = P80211ENUM_resultcode_success;
556 break;
557 case WLAN_MSD_FWLOAD:
558 case WLAN_MSD_RUNNING:
559 wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING;
561 * TODO: Shut down the MAC completely. Here a chip
562 * or board level reset is probably called for.
563 * After a "disable" _all_ results are lost, even
564 * those from a fwload.
566 if (!wlandev->hwremoved)
567 netif_carrier_off(wlandev->netdev);
569 hfa384x_drvr_stop(hw);
571 wlandev->macmode = WLAN_MACMODE_NONE;
572 wlandev->msdstate = WLAN_MSD_HWPRESENT;
573 result = P80211ENUM_resultcode_success;
574 break;
575 case WLAN_MSD_HWFAIL:
576 default:
577 /* probe() had a problem or the msdstate contains
578 * an unrecognized value, there's nothing we can do.
580 result = P80211ENUM_resultcode_implementation_failure;
581 break;
583 break;
584 default:
585 result = P80211ENUM_resultcode_invalid_parameters;
586 break;
589 return result;
592 /*----------------------------------------------------------------
593 * prism2sta_getcardinfo
595 * Collect the NICID, firmware version and any other identifiers
596 * we'd like to have in host-side data structures.
598 * Arguments:
599 * wlandev wlan device structure
601 * Returns:
602 * 0 success
603 * >0 f/w reported error
604 * <0 driver reported error
606 * Side effects:
608 * Call context:
609 * Either.
610 ----------------------------------------------------------------*/
611 static int prism2sta_getcardinfo(wlandevice_t *wlandev)
613 int result = 0;
614 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
615 u16 temp;
616 u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN];
617 char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1];
619 /* Collect version and compatibility info */
620 /* Some are critical, some are not */
621 /* NIC identity */
622 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY,
623 &hw->ident_nic,
624 sizeof(hfa384x_compident_t));
625 if (result) {
626 printk(KERN_ERR "Failed to retrieve NICIDENTITY\n");
627 goto failed;
630 /* get all the nic id fields in host byte order */
631 hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
632 hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
633 hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
634 hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
636 printk(KERN_INFO "ident: nic h/w: id=0x%02x %d.%d.%d\n",
637 hw->ident_nic.id, hw->ident_nic.major,
638 hw->ident_nic.minor, hw->ident_nic.variant);
640 /* Primary f/w identity */
641 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY,
642 &hw->ident_pri_fw,
643 sizeof(hfa384x_compident_t));
644 if (result) {
645 printk(KERN_ERR "Failed to retrieve PRIIDENTITY\n");
646 goto failed;
649 /* get all the private fw id fields in host byte order */
650 hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
651 hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
652 hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
653 hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
655 printk(KERN_INFO "ident: pri f/w: id=0x%02x %d.%d.%d\n",
656 hw->ident_pri_fw.id, hw->ident_pri_fw.major,
657 hw->ident_pri_fw.minor, hw->ident_pri_fw.variant);
659 /* Station (Secondary?) f/w identity */
660 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY,
661 &hw->ident_sta_fw,
662 sizeof(hfa384x_compident_t));
663 if (result) {
664 printk(KERN_ERR "Failed to retrieve STAIDENTITY\n");
665 goto failed;
668 if (hw->ident_nic.id < 0x8000) {
669 printk(KERN_ERR
670 "FATAL: Card is not an Intersil Prism2/2.5/3\n");
671 result = -1;
672 goto failed;
675 /* get all the station fw id fields in host byte order */
676 hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
677 hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
678 hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
679 hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
681 /* strip out the 'special' variant bits */
682 hw->mm_mods = hw->ident_sta_fw.variant & (BIT(14) | BIT(15));
683 hw->ident_sta_fw.variant &= ~((u16) (BIT(14) | BIT(15)));
685 if (hw->ident_sta_fw.id == 0x1f) {
686 printk(KERN_INFO
687 "ident: sta f/w: id=0x%02x %d.%d.%d\n",
688 hw->ident_sta_fw.id, hw->ident_sta_fw.major,
689 hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
690 } else {
691 printk(KERN_INFO
692 "ident: ap f/w: id=0x%02x %d.%d.%d\n",
693 hw->ident_sta_fw.id, hw->ident_sta_fw.major,
694 hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
695 printk(KERN_ERR "Unsupported Tertiary AP firmeare loaded!\n");
696 goto failed;
699 /* Compatibility range, Modem supplier */
700 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE,
701 &hw->cap_sup_mfi,
702 sizeof(hfa384x_caplevel_t));
703 if (result) {
704 printk(KERN_ERR "Failed to retrieve MFISUPRANGE\n");
705 goto failed;
708 /* get all the Compatibility range, modem interface supplier
709 fields in byte order */
710 hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
711 hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
712 hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
713 hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
714 hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
716 printk(KERN_INFO
717 "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
718 hw->cap_sup_mfi.role, hw->cap_sup_mfi.id,
719 hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom,
720 hw->cap_sup_mfi.top);
722 /* Compatibility range, Controller supplier */
723 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE,
724 &hw->cap_sup_cfi,
725 sizeof(hfa384x_caplevel_t));
726 if (result) {
727 printk(KERN_ERR "Failed to retrieve CFISUPRANGE\n");
728 goto failed;
731 /* get all the Compatibility range, controller interface supplier
732 fields in byte order */
733 hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
734 hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
735 hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
736 hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
737 hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
739 printk(KERN_INFO
740 "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
741 hw->cap_sup_cfi.role, hw->cap_sup_cfi.id,
742 hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom,
743 hw->cap_sup_cfi.top);
745 /* Compatibility range, Primary f/w supplier */
746 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE,
747 &hw->cap_sup_pri,
748 sizeof(hfa384x_caplevel_t));
749 if (result) {
750 printk(KERN_ERR "Failed to retrieve PRISUPRANGE\n");
751 goto failed;
754 /* get all the Compatibility range, primary firmware supplier
755 fields in byte order */
756 hw->cap_sup_pri.role = le16_to_cpu(hw->cap_sup_pri.role);
757 hw->cap_sup_pri.id = le16_to_cpu(hw->cap_sup_pri.id);
758 hw->cap_sup_pri.variant = le16_to_cpu(hw->cap_sup_pri.variant);
759 hw->cap_sup_pri.bottom = le16_to_cpu(hw->cap_sup_pri.bottom);
760 hw->cap_sup_pri.top = le16_to_cpu(hw->cap_sup_pri.top);
762 printk(KERN_INFO
763 "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
764 hw->cap_sup_pri.role, hw->cap_sup_pri.id,
765 hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom,
766 hw->cap_sup_pri.top);
768 /* Compatibility range, Station f/w supplier */
769 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE,
770 &hw->cap_sup_sta,
771 sizeof(hfa384x_caplevel_t));
772 if (result) {
773 printk(KERN_ERR "Failed to retrieve STASUPRANGE\n");
774 goto failed;
777 /* get all the Compatibility range, station firmware supplier
778 fields in byte order */
779 hw->cap_sup_sta.role = le16_to_cpu(hw->cap_sup_sta.role);
780 hw->cap_sup_sta.id = le16_to_cpu(hw->cap_sup_sta.id);
781 hw->cap_sup_sta.variant = le16_to_cpu(hw->cap_sup_sta.variant);
782 hw->cap_sup_sta.bottom = le16_to_cpu(hw->cap_sup_sta.bottom);
783 hw->cap_sup_sta.top = le16_to_cpu(hw->cap_sup_sta.top);
785 if (hw->cap_sup_sta.id == 0x04) {
786 printk(KERN_INFO
787 "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
788 hw->cap_sup_sta.role, hw->cap_sup_sta.id,
789 hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
790 hw->cap_sup_sta.top);
791 } else {
792 printk(KERN_INFO
793 "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
794 hw->cap_sup_sta.role, hw->cap_sup_sta.id,
795 hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
796 hw->cap_sup_sta.top);
799 /* Compatibility range, primary f/w actor, CFI supplier */
800 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES,
801 &hw->cap_act_pri_cfi,
802 sizeof(hfa384x_caplevel_t));
803 if (result) {
804 printk(KERN_ERR "Failed to retrieve PRI_CFIACTRANGES\n");
805 goto failed;
808 /* get all the Compatibility range, primary f/w actor, CFI supplier
809 fields in byte order */
810 hw->cap_act_pri_cfi.role = le16_to_cpu(hw->cap_act_pri_cfi.role);
811 hw->cap_act_pri_cfi.id = le16_to_cpu(hw->cap_act_pri_cfi.id);
812 hw->cap_act_pri_cfi.variant = le16_to_cpu(hw->cap_act_pri_cfi.variant);
813 hw->cap_act_pri_cfi.bottom = le16_to_cpu(hw->cap_act_pri_cfi.bottom);
814 hw->cap_act_pri_cfi.top = le16_to_cpu(hw->cap_act_pri_cfi.top);
816 printk(KERN_INFO
817 "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
818 hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id,
819 hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom,
820 hw->cap_act_pri_cfi.top);
822 /* Compatibility range, sta f/w actor, CFI supplier */
823 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES,
824 &hw->cap_act_sta_cfi,
825 sizeof(hfa384x_caplevel_t));
826 if (result) {
827 printk(KERN_ERR "Failed to retrieve STA_CFIACTRANGES\n");
828 goto failed;
831 /* get all the Compatibility range, station f/w actor, CFI supplier
832 fields in byte order */
833 hw->cap_act_sta_cfi.role = le16_to_cpu(hw->cap_act_sta_cfi.role);
834 hw->cap_act_sta_cfi.id = le16_to_cpu(hw->cap_act_sta_cfi.id);
835 hw->cap_act_sta_cfi.variant = le16_to_cpu(hw->cap_act_sta_cfi.variant);
836 hw->cap_act_sta_cfi.bottom = le16_to_cpu(hw->cap_act_sta_cfi.bottom);
837 hw->cap_act_sta_cfi.top = le16_to_cpu(hw->cap_act_sta_cfi.top);
839 printk(KERN_INFO
840 "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
841 hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id,
842 hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom,
843 hw->cap_act_sta_cfi.top);
845 /* Compatibility range, sta f/w actor, MFI supplier */
846 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES,
847 &hw->cap_act_sta_mfi,
848 sizeof(hfa384x_caplevel_t));
849 if (result) {
850 printk(KERN_ERR "Failed to retrieve STA_MFIACTRANGES\n");
851 goto failed;
854 /* get all the Compatibility range, station f/w actor, MFI supplier
855 fields in byte order */
856 hw->cap_act_sta_mfi.role = le16_to_cpu(hw->cap_act_sta_mfi.role);
857 hw->cap_act_sta_mfi.id = le16_to_cpu(hw->cap_act_sta_mfi.id);
858 hw->cap_act_sta_mfi.variant = le16_to_cpu(hw->cap_act_sta_mfi.variant);
859 hw->cap_act_sta_mfi.bottom = le16_to_cpu(hw->cap_act_sta_mfi.bottom);
860 hw->cap_act_sta_mfi.top = le16_to_cpu(hw->cap_act_sta_mfi.top);
862 printk(KERN_INFO
863 "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
864 hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id,
865 hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom,
866 hw->cap_act_sta_mfi.top);
868 /* Serial Number */
869 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER,
870 snum, HFA384x_RID_NICSERIALNUMBER_LEN);
871 if (!result) {
872 wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN,
873 pstr, sizeof(pstr));
874 printk(KERN_INFO "Prism2 card SN: %s\n", pstr);
875 } else {
876 printk(KERN_ERR "Failed to retrieve Prism2 Card SN\n");
877 goto failed;
880 /* Collect the MAC address */
881 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR,
882 wlandev->netdev->dev_addr, ETH_ALEN);
883 if (result != 0) {
884 printk(KERN_ERR "Failed to retrieve mac address\n");
885 goto failed;
888 /* short preamble is always implemented */
889 wlandev->nsdcaps |= P80211_NSDCAP_SHORT_PREAMBLE;
891 /* find out if hardware wep is implemented */
892 hfa384x_drvr_getconfig16(hw, HFA384x_RID_PRIVACYOPTIMP, &temp);
893 if (temp)
894 wlandev->nsdcaps |= P80211_NSDCAP_HARDWAREWEP;
896 /* get the dBm Scaling constant */
897 hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFDBMADJUST, &temp);
898 hw->dbmadjust = temp;
900 /* Only enable scan by default on newer firmware */
901 if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major,
902 hw->ident_sta_fw.minor,
903 hw->ident_sta_fw.variant) <
904 HFA384x_FIRMWARE_VERSION(1, 5, 5)) {
905 wlandev->nsdcaps |= P80211_NSDCAP_NOSCAN;
908 /* TODO: Set any internally managed config items */
910 goto done;
911 failed:
912 printk(KERN_ERR "Failed, result=%d\n", result);
913 done:
914 return result;
917 /*----------------------------------------------------------------
918 * prism2sta_globalsetup
920 * Set any global RIDs that we want to set at device activation.
922 * Arguments:
923 * wlandev wlan device structure
925 * Returns:
926 * 0 success
927 * >0 f/w reported error
928 * <0 driver reported error
930 * Side effects:
932 * Call context:
933 * process thread
934 ----------------------------------------------------------------*/
935 static int prism2sta_globalsetup(wlandevice_t *wlandev)
937 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
939 /* Set the maximum frame size */
940 return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN,
941 WLAN_DATA_MAXLEN);
944 static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev)
946 int result = 0;
947 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
949 u16 promisc;
951 /* If we're not ready, what's the point? */
952 if (hw->state != HFA384x_STATE_RUNNING)
953 goto exit;
955 if ((dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
956 promisc = P80211ENUM_truth_true;
957 else
958 promisc = P80211ENUM_truth_false;
960 result =
961 hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE,
962 promisc);
963 exit:
964 return result;
967 /*----------------------------------------------------------------
968 * prism2sta_inf_handover
970 * Handles the receipt of a Handover info frame. Should only be present
971 * in APs only.
973 * Arguments:
974 * wlandev wlan device structure
975 * inf ptr to info frame (contents in hfa384x order)
977 * Returns:
978 * nothing
980 * Side effects:
982 * Call context:
983 * interrupt
984 ----------------------------------------------------------------*/
985 static void prism2sta_inf_handover(wlandevice_t *wlandev,
986 hfa384x_InfFrame_t *inf)
988 pr_debug("received infoframe:HANDOVER (unhandled)\n");
991 /*----------------------------------------------------------------
992 * prism2sta_inf_tallies
994 * Handles the receipt of a CommTallies info frame.
996 * Arguments:
997 * wlandev wlan device structure
998 * inf ptr to info frame (contents in hfa384x order)
1000 * Returns:
1001 * nothing
1003 * Side effects:
1005 * Call context:
1006 * interrupt
1007 ----------------------------------------------------------------*/
1008 static void prism2sta_inf_tallies(wlandevice_t *wlandev,
1009 hfa384x_InfFrame_t *inf)
1011 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1012 u16 *src16;
1013 u32 *dst;
1014 u32 *src32;
1015 int i;
1016 int cnt;
1019 ** Determine if these are 16-bit or 32-bit tallies, based on the
1020 ** record length of the info record.
1023 cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(u32);
1024 if (inf->framelen > 22) {
1025 dst = (u32 *) &hw->tallies;
1026 src32 = (u32 *) &inf->info.commtallies32;
1027 for (i = 0; i < cnt; i++, dst++, src32++)
1028 *dst += le32_to_cpu(*src32);
1029 } else {
1030 dst = (u32 *) &hw->tallies;
1031 src16 = (u16 *) &inf->info.commtallies16;
1032 for (i = 0; i < cnt; i++, dst++, src16++)
1033 *dst += le16_to_cpu(*src16);
1037 /*----------------------------------------------------------------
1038 * prism2sta_inf_scanresults
1040 * Handles the receipt of a Scan Results info frame.
1042 * Arguments:
1043 * wlandev wlan device structure
1044 * inf ptr to info frame (contents in hfa384x order)
1046 * Returns:
1047 * nothing
1049 * Side effects:
1051 * Call context:
1052 * interrupt
1053 ----------------------------------------------------------------*/
1054 static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
1055 hfa384x_InfFrame_t *inf)
1058 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1059 int nbss;
1060 hfa384x_ScanResult_t *sr = &(inf->info.scanresult);
1061 int i;
1062 hfa384x_JoinRequest_data_t joinreq;
1063 int result;
1065 /* Get the number of results, first in bytes, then in results */
1066 nbss = (inf->framelen * sizeof(u16)) -
1067 sizeof(inf->infotype) - sizeof(inf->info.scanresult.scanreason);
1068 nbss /= sizeof(hfa384x_ScanResultSub_t);
1070 /* Print em */
1071 pr_debug("rx scanresults, reason=%d, nbss=%d:\n",
1072 inf->info.scanresult.scanreason, nbss);
1073 for (i = 0; i < nbss; i++) {
1074 pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n",
1075 sr->result[i].chid,
1076 sr->result[i].anl,
1077 sr->result[i].sl, sr->result[i].bcnint);
1078 pr_debug(" capinfo=0x%04x proberesp_rate=%d\n",
1079 sr->result[i].capinfo, sr->result[i].proberesp_rate);
1081 /* issue a join request */
1082 joinreq.channel = sr->result[0].chid;
1083 memcpy(joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN);
1084 result = hfa384x_drvr_setconfig(hw,
1085 HFA384x_RID_JOINREQUEST,
1086 &joinreq, HFA384x_RID_JOINREQUEST_LEN);
1087 if (result) {
1088 printk(KERN_ERR "setconfig(joinreq) failed, result=%d\n",
1089 result);
1093 /*----------------------------------------------------------------
1094 * prism2sta_inf_hostscanresults
1096 * Handles the receipt of a Scan Results info frame.
1098 * Arguments:
1099 * wlandev wlan device structure
1100 * inf ptr to info frame (contents in hfa384x order)
1102 * Returns:
1103 * nothing
1105 * Side effects:
1107 * Call context:
1108 * interrupt
1109 ----------------------------------------------------------------*/
1110 static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
1111 hfa384x_InfFrame_t *inf)
1113 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1114 int nbss;
1116 nbss = (inf->framelen - 3) / 32;
1117 pr_debug("Received %d hostscan results\n", nbss);
1119 if (nbss > 32)
1120 nbss = 32;
1122 kfree(hw->scanresults);
1124 hw->scanresults = kmemdup(inf, sizeof(hfa384x_InfFrame_t), GFP_ATOMIC);
1126 if (nbss == 0)
1127 nbss = -1;
1129 /* Notify/wake the sleeping caller. */
1130 hw->scanflag = nbss;
1131 wake_up_interruptible(&hw->cmdq);
1134 /*----------------------------------------------------------------
1135 * prism2sta_inf_chinforesults
1137 * Handles the receipt of a Channel Info Results info frame.
1139 * Arguments:
1140 * wlandev wlan device structure
1141 * inf ptr to info frame (contents in hfa384x order)
1143 * Returns:
1144 * nothing
1146 * Side effects:
1148 * Call context:
1149 * interrupt
1150 ----------------------------------------------------------------*/
1151 static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
1152 hfa384x_InfFrame_t *inf)
1154 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1155 unsigned int i, n;
1157 hw->channel_info.results.scanchannels =
1158 le16_to_cpu(inf->info.chinforesult.scanchannels);
1160 for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) {
1161 hfa384x_ChInfoResultSub_t *result;
1162 hfa384x_ChInfoResultSub_t *chinforesult;
1163 int chan;
1165 if (!(hw->channel_info.results.scanchannels & (1 << i)))
1166 continue;
1168 result = &inf->info.chinforesult.result[n];
1169 chan = le16_to_cpu(result->chid) - 1;
1171 if (chan < 0 || chan >= HFA384x_CHINFORESULT_MAX)
1172 continue;
1174 chinforesult = &hw->channel_info.results.result[chan];
1175 chinforesult->chid = chan;
1176 chinforesult->anl = le16_to_cpu(result->anl);
1177 chinforesult->pnl = le16_to_cpu(result->pnl);
1178 chinforesult->active = le16_to_cpu(result->active);
1180 pr_debug("chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
1181 chan + 1,
1182 (chinforesult->active & HFA384x_CHINFORESULT_BSSACTIVE)
1183 ? "signal" : "noise",
1184 chinforesult->anl, chinforesult->pnl,
1185 (chinforesult->active & HFA384x_CHINFORESULT_PCFACTIVE)
1186 ? 1 : 0);
1187 n++;
1189 atomic_set(&hw->channel_info.done, 2);
1191 hw->channel_info.count = n;
1194 void prism2sta_processing_defer(struct work_struct *data)
1196 hfa384x_t *hw = container_of(data, struct hfa384x, link_bh);
1197 wlandevice_t *wlandev = hw->wlandev;
1198 hfa384x_bytestr32_t ssid;
1199 int result;
1201 /* First let's process the auth frames */
1203 struct sk_buff *skb;
1204 hfa384x_InfFrame_t *inf;
1206 while ((skb = skb_dequeue(&hw->authq))) {
1207 inf = (hfa384x_InfFrame_t *) skb->data;
1208 prism2sta_inf_authreq_defer(wlandev, inf);
1213 /* Now let's handle the linkstatus stuff */
1214 if (hw->link_status == hw->link_status_new)
1215 return;
1217 hw->link_status = hw->link_status_new;
1219 switch (hw->link_status) {
1220 case HFA384x_LINK_NOTCONNECTED:
1221 /* I'm currently assuming that this is the initial link
1222 * state. It should only be possible immediately
1223 * following an Enable command.
1224 * Response:
1225 * Block Transmits, Ignore receives of data frames
1227 netif_carrier_off(wlandev->netdev);
1229 printk(KERN_INFO "linkstatus=NOTCONNECTED (unhandled)\n");
1230 break;
1232 case HFA384x_LINK_CONNECTED:
1233 /* This one indicates a successful scan/join/auth/assoc.
1234 * When we have the full MLME complement, this event will
1235 * signify successful completion of both mlme_authenticate
1236 * and mlme_associate. State management will get a little
1237 * ugly here.
1238 * Response:
1239 * Indicate authentication and/or association
1240 * Enable Transmits, Receives and pass up data frames
1243 netif_carrier_on(wlandev->netdev);
1245 /* If we are joining a specific AP, set our
1246 * state and reset retries
1248 if (hw->join_ap == 1)
1249 hw->join_ap = 2;
1250 hw->join_retries = 60;
1252 /* Don't call this in monitor mode */
1253 if (wlandev->netdev->type == ARPHRD_ETHER) {
1254 u16 portstatus;
1256 printk(KERN_INFO "linkstatus=CONNECTED\n");
1258 /* For non-usb devices, we can use the sync versions */
1259 /* Collect the BSSID, and set state to allow tx */
1261 result = hfa384x_drvr_getconfig(hw,
1262 HFA384x_RID_CURRENTBSSID,
1263 wlandev->bssid,
1264 WLAN_BSSID_LEN);
1265 if (result) {
1266 pr_debug
1267 ("getconfig(0x%02x) failed, result = %d\n",
1268 HFA384x_RID_CURRENTBSSID, result);
1269 return;
1272 result = hfa384x_drvr_getconfig(hw,
1273 HFA384x_RID_CURRENTSSID,
1274 &ssid, sizeof(ssid));
1275 if (result) {
1276 pr_debug
1277 ("getconfig(0x%02x) failed, result = %d\n",
1278 HFA384x_RID_CURRENTSSID, result);
1279 return;
1281 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
1282 (p80211pstrd_t *) &
1283 wlandev->ssid);
1285 /* Collect the port status */
1286 result = hfa384x_drvr_getconfig16(hw,
1287 HFA384x_RID_PORTSTATUS,
1288 &portstatus);
1289 if (result) {
1290 pr_debug
1291 ("getconfig(0x%02x) failed, result = %d\n",
1292 HFA384x_RID_PORTSTATUS, result);
1293 return;
1295 wlandev->macmode =
1296 (portstatus == HFA384x_PSTATUS_CONN_IBSS) ?
1297 WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA;
1299 /* signal back up to cfg80211 layer */
1300 prism2_connect_result(wlandev, P80211ENUM_truth_false);
1302 /* Get the ball rolling on the comms quality stuff */
1303 prism2sta_commsqual_defer(&hw->commsqual_bh);
1305 break;
1307 case HFA384x_LINK_DISCONNECTED:
1308 /* This one indicates that our association is gone. We've
1309 * lost connection with the AP and/or been disassociated.
1310 * This indicates that the MAC has completely cleared it's
1311 * associated state. We * should send a deauth indication
1312 * (implying disassoc) up * to the MLME.
1313 * Response:
1314 * Indicate Deauthentication
1315 * Block Transmits, Ignore receives of data frames
1317 if (wlandev->netdev->type == ARPHRD_ETHER)
1318 printk(KERN_INFO
1319 "linkstatus=DISCONNECTED (unhandled)\n");
1320 wlandev->macmode = WLAN_MACMODE_NONE;
1322 netif_carrier_off(wlandev->netdev);
1324 /* signal back up to cfg80211 layer */
1325 prism2_disconnected(wlandev);
1327 break;
1329 case HFA384x_LINK_AP_CHANGE:
1330 /* This one indicates that the MAC has decided to and
1331 * successfully completed a change to another AP. We
1332 * should probably implement a reassociation indication
1333 * in response to this one. I'm thinking that the the
1334 * p80211 layer needs to be notified in case of
1335 * buffering/queueing issues. User mode also needs to be
1336 * notified so that any BSS dependent elements can be
1337 * updated.
1338 * associated state. We * should send a deauth indication
1339 * (implying disassoc) up * to the MLME.
1340 * Response:
1341 * Indicate Reassociation
1342 * Enable Transmits, Receives and pass up data frames
1344 printk(KERN_INFO "linkstatus=AP_CHANGE\n");
1346 result = hfa384x_drvr_getconfig(hw,
1347 HFA384x_RID_CURRENTBSSID,
1348 wlandev->bssid, WLAN_BSSID_LEN);
1349 if (result) {
1350 pr_debug("getconfig(0x%02x) failed, result = %d\n",
1351 HFA384x_RID_CURRENTBSSID, result);
1352 return;
1355 result = hfa384x_drvr_getconfig(hw,
1356 HFA384x_RID_CURRENTSSID,
1357 &ssid, sizeof(ssid));
1358 if (result) {
1359 pr_debug("getconfig(0x%02x) failed, result = %d\n",
1360 HFA384x_RID_CURRENTSSID, result);
1361 return;
1363 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
1364 (p80211pstrd_t *) &wlandev->ssid);
1366 hw->link_status = HFA384x_LINK_CONNECTED;
1367 netif_carrier_on(wlandev->netdev);
1369 /* signal back up to cfg80211 layer */
1370 prism2_roamed(wlandev);
1372 break;
1374 case HFA384x_LINK_AP_OUTOFRANGE:
1375 /* This one indicates that the MAC has decided that the
1376 * AP is out of range, but hasn't found a better candidate
1377 * so the MAC maintains its "associated" state in case
1378 * we get back in range. We should block transmits and
1379 * receives in this state. Do we need an indication here?
1380 * Probably not since a polling user-mode element would
1381 * get this status from from p2PortStatus(FD40). What about
1382 * p80211?
1383 * Response:
1384 * Block Transmits, Ignore receives of data frames
1386 printk(KERN_INFO "linkstatus=AP_OUTOFRANGE (unhandled)\n");
1388 netif_carrier_off(wlandev->netdev);
1390 break;
1392 case HFA384x_LINK_AP_INRANGE:
1393 /* This one indicates that the MAC has decided that the
1394 * AP is back in range. We continue working with our
1395 * existing association.
1396 * Response:
1397 * Enable Transmits, Receives and pass up data frames
1399 printk(KERN_INFO "linkstatus=AP_INRANGE\n");
1401 hw->link_status = HFA384x_LINK_CONNECTED;
1402 netif_carrier_on(wlandev->netdev);
1404 break;
1406 case HFA384x_LINK_ASSOCFAIL:
1407 /* This one is actually a peer to CONNECTED. We've
1408 * requested a join for a given SSID and optionally BSSID.
1409 * We can use this one to indicate authentication and
1410 * association failures. The trick is going to be
1411 * 1) identifying the failure, and 2) state management.
1412 * Response:
1413 * Disable Transmits, Ignore receives of data frames
1415 if (hw->join_ap && --hw->join_retries > 0) {
1416 hfa384x_JoinRequest_data_t joinreq;
1417 joinreq = hw->joinreq;
1418 /* Send the join request */
1419 hfa384x_drvr_setconfig(hw,
1420 HFA384x_RID_JOINREQUEST,
1421 &joinreq,
1422 HFA384x_RID_JOINREQUEST_LEN);
1423 printk(KERN_INFO
1424 "linkstatus=ASSOCFAIL (re-submitting join)\n");
1425 } else {
1426 printk(KERN_INFO "linkstatus=ASSOCFAIL (unhandled)\n");
1429 netif_carrier_off(wlandev->netdev);
1431 /* signal back up to cfg80211 layer */
1432 prism2_connect_result(wlandev, P80211ENUM_truth_true);
1434 break;
1436 default:
1437 /* This is bad, IO port problems? */
1438 printk(KERN_WARNING
1439 "unknown linkstatus=0x%02x\n", hw->link_status);
1440 return;
1443 wlandev->linkstatus = (hw->link_status == HFA384x_LINK_CONNECTED);
1446 /*----------------------------------------------------------------
1447 * prism2sta_inf_linkstatus
1449 * Handles the receipt of a Link Status info frame.
1451 * Arguments:
1452 * wlandev wlan device structure
1453 * inf ptr to info frame (contents in hfa384x order)
1455 * Returns:
1456 * nothing
1458 * Side effects:
1460 * Call context:
1461 * interrupt
1462 ----------------------------------------------------------------*/
1463 static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
1464 hfa384x_InfFrame_t *inf)
1466 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1468 hw->link_status_new = le16_to_cpu(inf->info.linkstatus.linkstatus);
1470 schedule_work(&hw->link_bh);
1473 /*----------------------------------------------------------------
1474 * prism2sta_inf_assocstatus
1476 * Handles the receipt of an Association Status info frame. Should
1477 * be present in APs only.
1479 * Arguments:
1480 * wlandev wlan device structure
1481 * inf ptr to info frame (contents in hfa384x order)
1483 * Returns:
1484 * nothing
1486 * Side effects:
1488 * Call context:
1489 * interrupt
1490 ----------------------------------------------------------------*/
1491 static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
1492 hfa384x_InfFrame_t *inf)
1494 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1495 hfa384x_AssocStatus_t rec;
1496 int i;
1498 memcpy(&rec, &inf->info.assocstatus, sizeof(rec));
1499 rec.assocstatus = le16_to_cpu(rec.assocstatus);
1500 rec.reason = le16_to_cpu(rec.reason);
1503 ** Find the address in the list of authenticated stations.
1504 ** If it wasn't found, then this address has not been previously
1505 ** authenticated and something weird has happened if this is
1506 ** anything other than an "authentication failed" message.
1507 ** If the address was found, then set the "associated" flag for
1508 ** that station, based on whether the station is associating or
1509 ** losing its association. Something weird has also happened
1510 ** if we find the address in the list of authenticated stations
1511 ** but we are getting an "authentication failed" message.
1514 for (i = 0; i < hw->authlist.cnt; i++)
1515 if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0)
1516 break;
1518 if (i >= hw->authlist.cnt) {
1519 if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL)
1520 printk(KERN_WARNING
1521 "assocstatus info frame received for non-authenticated station.\n");
1522 } else {
1523 hw->authlist.assoc[i] =
1524 (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC ||
1525 rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC);
1527 if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL)
1528 printk(KERN_WARNING
1529 "authfail assocstatus info frame received for authenticated station.\n");
1533 /*----------------------------------------------------------------
1534 * prism2sta_inf_authreq
1536 * Handles the receipt of an Authentication Request info frame. Should
1537 * be present in APs only.
1539 * Arguments:
1540 * wlandev wlan device structure
1541 * inf ptr to info frame (contents in hfa384x order)
1543 * Returns:
1544 * nothing
1546 * Side effects:
1548 * Call context:
1549 * interrupt
1551 ----------------------------------------------------------------*/
1552 static void prism2sta_inf_authreq(wlandevice_t *wlandev,
1553 hfa384x_InfFrame_t *inf)
1555 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1556 struct sk_buff *skb;
1558 skb = dev_alloc_skb(sizeof(*inf));
1559 if (skb) {
1560 skb_put(skb, sizeof(*inf));
1561 memcpy(skb->data, inf, sizeof(*inf));
1562 skb_queue_tail(&hw->authq, skb);
1563 schedule_work(&hw->link_bh);
1567 static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
1568 hfa384x_InfFrame_t *inf)
1570 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1571 hfa384x_authenticateStation_data_t rec;
1573 int i, added, result, cnt;
1574 u8 *addr;
1577 ** Build the AuthenticateStation record. Initialize it for denying
1578 ** authentication.
1581 memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN);
1582 rec.status = P80211ENUM_status_unspec_failure;
1585 ** Authenticate based on the access mode.
1588 switch (hw->accessmode) {
1589 case WLAN_ACCESS_NONE:
1592 ** Deny all new authentications. However, if a station
1593 ** is ALREADY authenticated, then accept it.
1596 for (i = 0; i < hw->authlist.cnt; i++)
1597 if (memcmp(rec.address, hw->authlist.addr[i],
1598 ETH_ALEN) == 0) {
1599 rec.status = P80211ENUM_status_successful;
1600 break;
1603 break;
1605 case WLAN_ACCESS_ALL:
1608 ** Allow all authentications.
1611 rec.status = P80211ENUM_status_successful;
1612 break;
1614 case WLAN_ACCESS_ALLOW:
1617 ** Only allow the authentication if the MAC address
1618 ** is in the list of allowed addresses.
1620 ** Since this is the interrupt handler, we may be here
1621 ** while the access list is in the middle of being
1622 ** updated. Choose the list which is currently okay.
1623 ** See "prism2mib_priv_accessallow()" for details.
1626 if (hw->allow.modify == 0) {
1627 cnt = hw->allow.cnt;
1628 addr = hw->allow.addr[0];
1629 } else {
1630 cnt = hw->allow.cnt1;
1631 addr = hw->allow.addr1[0];
1634 for (i = 0; i < cnt; i++, addr += ETH_ALEN)
1635 if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
1636 rec.status = P80211ENUM_status_successful;
1637 break;
1640 break;
1642 case WLAN_ACCESS_DENY:
1645 ** Allow the authentication UNLESS the MAC address is
1646 ** in the list of denied addresses.
1648 ** Since this is the interrupt handler, we may be here
1649 ** while the access list is in the middle of being
1650 ** updated. Choose the list which is currently okay.
1651 ** See "prism2mib_priv_accessdeny()" for details.
1654 if (hw->deny.modify == 0) {
1655 cnt = hw->deny.cnt;
1656 addr = hw->deny.addr[0];
1657 } else {
1658 cnt = hw->deny.cnt1;
1659 addr = hw->deny.addr1[0];
1662 rec.status = P80211ENUM_status_successful;
1664 for (i = 0; i < cnt; i++, addr += ETH_ALEN)
1665 if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
1666 rec.status = P80211ENUM_status_unspec_failure;
1667 break;
1670 break;
1674 ** If the authentication is okay, then add the MAC address to the
1675 ** list of authenticated stations. Don't add the address if it
1676 ** is already in the list. (802.11b does not seem to disallow
1677 ** a station from issuing an authentication request when the
1678 ** station is already authenticated. Does this sort of thing
1679 ** ever happen? We might as well do the check just in case.)
1682 added = 0;
1684 if (rec.status == P80211ENUM_status_successful) {
1685 for (i = 0; i < hw->authlist.cnt; i++)
1686 if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
1687 == 0)
1688 break;
1690 if (i >= hw->authlist.cnt) {
1691 if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
1692 rec.status = P80211ENUM_status_ap_full;
1693 } else {
1694 memcpy(hw->authlist.addr[hw->authlist.cnt],
1695 rec.address, ETH_ALEN);
1696 hw->authlist.cnt++;
1697 added = 1;
1703 ** Send back the results of the authentication. If this doesn't work,
1704 ** then make sure to remove the address from the authenticated list if
1705 ** it was added.
1708 rec.status = cpu_to_le16(rec.status);
1709 rec.algorithm = inf->info.authreq.algorithm;
1711 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA,
1712 &rec, sizeof(rec));
1713 if (result) {
1714 if (added)
1715 hw->authlist.cnt--;
1716 printk(KERN_ERR
1717 "setconfig(authenticatestation) failed, result=%d\n",
1718 result);
1722 /*----------------------------------------------------------------
1723 * prism2sta_inf_psusercnt
1725 * Handles the receipt of a PowerSaveUserCount info frame. Should
1726 * be present in APs only.
1728 * Arguments:
1729 * wlandev wlan device structure
1730 * inf ptr to info frame (contents in hfa384x order)
1732 * Returns:
1733 * nothing
1735 * Side effects:
1737 * Call context:
1738 * interrupt
1739 ----------------------------------------------------------------*/
1740 static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
1741 hfa384x_InfFrame_t *inf)
1743 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1745 hw->psusercount = le16_to_cpu(inf->info.psusercnt.usercnt);
1748 /*----------------------------------------------------------------
1749 * prism2sta_ev_info
1751 * Handles the Info event.
1753 * Arguments:
1754 * wlandev wlan device structure
1755 * inf ptr to a generic info frame
1757 * Returns:
1758 * nothing
1760 * Side effects:
1762 * Call context:
1763 * interrupt
1764 ----------------------------------------------------------------*/
1765 void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
1767 inf->infotype = le16_to_cpu(inf->infotype);
1768 /* Dispatch */
1769 switch (inf->infotype) {
1770 case HFA384x_IT_HANDOVERADDR:
1771 prism2sta_inf_handover(wlandev, inf);
1772 break;
1773 case HFA384x_IT_COMMTALLIES:
1774 prism2sta_inf_tallies(wlandev, inf);
1775 break;
1776 case HFA384x_IT_HOSTSCANRESULTS:
1777 prism2sta_inf_hostscanresults(wlandev, inf);
1778 break;
1779 case HFA384x_IT_SCANRESULTS:
1780 prism2sta_inf_scanresults(wlandev, inf);
1781 break;
1782 case HFA384x_IT_CHINFORESULTS:
1783 prism2sta_inf_chinforesults(wlandev, inf);
1784 break;
1785 case HFA384x_IT_LINKSTATUS:
1786 prism2sta_inf_linkstatus(wlandev, inf);
1787 break;
1788 case HFA384x_IT_ASSOCSTATUS:
1789 prism2sta_inf_assocstatus(wlandev, inf);
1790 break;
1791 case HFA384x_IT_AUTHREQ:
1792 prism2sta_inf_authreq(wlandev, inf);
1793 break;
1794 case HFA384x_IT_PSUSERCNT:
1795 prism2sta_inf_psusercnt(wlandev, inf);
1796 break;
1797 case HFA384x_IT_KEYIDCHANGED:
1798 printk(KERN_WARNING "Unhandled IT_KEYIDCHANGED\n");
1799 break;
1800 case HFA384x_IT_ASSOCREQ:
1801 printk(KERN_WARNING "Unhandled IT_ASSOCREQ\n");
1802 break;
1803 case HFA384x_IT_MICFAILURE:
1804 printk(KERN_WARNING "Unhandled IT_MICFAILURE\n");
1805 break;
1806 default:
1807 printk(KERN_WARNING
1808 "Unknown info type=0x%02x\n", inf->infotype);
1809 break;
1813 /*----------------------------------------------------------------
1814 * prism2sta_ev_txexc
1816 * Handles the TxExc event. A Transmit Exception event indicates
1817 * that the MAC's TX process was unsuccessful - so the packet did
1818 * not get transmitted.
1820 * Arguments:
1821 * wlandev wlan device structure
1822 * status tx frame status word
1824 * Returns:
1825 * nothing
1827 * Side effects:
1829 * Call context:
1830 * interrupt
1831 ----------------------------------------------------------------*/
1832 void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status)
1834 pr_debug("TxExc status=0x%x.\n", status);
1837 /*----------------------------------------------------------------
1838 * prism2sta_ev_tx
1840 * Handles the Tx event.
1842 * Arguments:
1843 * wlandev wlan device structure
1844 * status tx frame status word
1845 * Returns:
1846 * nothing
1848 * Side effects:
1850 * Call context:
1851 * interrupt
1852 ----------------------------------------------------------------*/
1853 void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
1855 pr_debug("Tx Complete, status=0x%04x\n", status);
1856 /* update linux network stats */
1857 wlandev->linux_stats.tx_packets++;
1860 /*----------------------------------------------------------------
1861 * prism2sta_ev_rx
1863 * Handles the Rx event.
1865 * Arguments:
1866 * wlandev wlan device structure
1868 * Returns:
1869 * nothing
1871 * Side effects:
1873 * Call context:
1874 * interrupt
1875 ----------------------------------------------------------------*/
1876 void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
1878 p80211netdev_rx(wlandev, skb);
1881 /*----------------------------------------------------------------
1882 * prism2sta_ev_alloc
1884 * Handles the Alloc event.
1886 * Arguments:
1887 * wlandev wlan device structure
1889 * Returns:
1890 * nothing
1892 * Side effects:
1894 * Call context:
1895 * interrupt
1896 ----------------------------------------------------------------*/
1897 void prism2sta_ev_alloc(wlandevice_t *wlandev)
1899 netif_wake_queue(wlandev->netdev);
1902 /*----------------------------------------------------------------
1903 * create_wlan
1905 * Called at module init time. This creates the wlandevice_t structure
1906 * and initializes it with relevant bits.
1908 * Arguments:
1909 * none
1911 * Returns:
1912 * the created wlandevice_t structure.
1914 * Side effects:
1915 * also allocates the priv/hw structures.
1917 * Call context:
1918 * process thread
1920 ----------------------------------------------------------------*/
1921 static wlandevice_t *create_wlan(void)
1923 wlandevice_t *wlandev = NULL;
1924 hfa384x_t *hw = NULL;
1926 /* Alloc our structures */
1927 wlandev = kzalloc(sizeof(wlandevice_t), GFP_KERNEL);
1928 hw = kzalloc(sizeof(hfa384x_t), GFP_KERNEL);
1930 if (!wlandev || !hw) {
1931 printk(KERN_ERR "%s: Memory allocation failure.\n", dev_info);
1932 kfree(wlandev);
1933 kfree(hw);
1934 return NULL;
1937 /* Initialize the network device object. */
1938 wlandev->nsdname = dev_info;
1939 wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING;
1940 wlandev->priv = hw;
1941 wlandev->open = prism2sta_open;
1942 wlandev->close = prism2sta_close;
1943 wlandev->reset = prism2sta_reset;
1944 wlandev->txframe = prism2sta_txframe;
1945 wlandev->mlmerequest = prism2sta_mlmerequest;
1946 wlandev->set_multicast_list = prism2sta_setmulticast;
1947 wlandev->tx_timeout = hfa384x_tx_timeout;
1949 wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | P80211_NSDCAP_AUTOJOIN;
1951 /* Initialize the device private data structure. */
1952 hw->dot11_desired_bss_type = 1;
1954 return wlandev;
1957 void prism2sta_commsqual_defer(struct work_struct *data)
1959 hfa384x_t *hw = container_of(data, struct hfa384x, commsqual_bh);
1960 wlandevice_t *wlandev = hw->wlandev;
1961 hfa384x_bytestr32_t ssid;
1962 struct p80211msg_dot11req_mibget msg;
1963 p80211item_uint32_t *mibitem = (p80211item_uint32_t *)
1964 &msg.mibattribute.data;
1965 int result = 0;
1967 if (hw->wlandev->hwremoved)
1968 return;
1970 /* we don't care if we're in AP mode */
1971 if ((wlandev->macmode == WLAN_MACMODE_NONE) ||
1972 (wlandev->macmode == WLAN_MACMODE_ESS_AP)) {
1973 return;
1976 /* It only makes sense to poll these in non-IBSS */
1977 if (wlandev->macmode != WLAN_MACMODE_IBSS_STA) {
1978 result = hfa384x_drvr_getconfig(
1979 hw, HFA384x_RID_DBMCOMMSQUALITY,
1980 &hw->qual, HFA384x_RID_DBMCOMMSQUALITY_LEN);
1982 if (result) {
1983 printk(KERN_ERR "error fetching commsqual\n");
1984 return;
1987 pr_debug("commsqual %d %d %d\n",
1988 le16_to_cpu(hw->qual.CQ_currBSS),
1989 le16_to_cpu(hw->qual.ASL_currBSS),
1990 le16_to_cpu(hw->qual.ANL_currFC));
1993 /* Get the signal rate */
1994 msg.msgcode = DIDmsg_dot11req_mibget;
1995 mibitem->did = DIDmib_p2_p2MAC_p2CurrentTxRate;
1996 result = p80211req_dorequest(wlandev, (u8 *) &msg);
1998 if (result) {
1999 pr_debug("get signal rate failed, result = %d\n",
2000 result);
2001 return;
2004 switch (mibitem->data) {
2005 case HFA384x_RATEBIT_1:
2006 hw->txrate = 10;
2007 break;
2008 case HFA384x_RATEBIT_2:
2009 hw->txrate = 20;
2010 break;
2011 case HFA384x_RATEBIT_5dot5:
2012 hw->txrate = 55;
2013 break;
2014 case HFA384x_RATEBIT_11:
2015 hw->txrate = 110;
2016 break;
2017 default:
2018 pr_debug("Bad ratebit (%d)\n", mibitem->data);
2021 /* Lastly, we need to make sure the BSSID didn't change on us */
2022 result = hfa384x_drvr_getconfig(hw,
2023 HFA384x_RID_CURRENTBSSID,
2024 wlandev->bssid, WLAN_BSSID_LEN);
2025 if (result) {
2026 pr_debug("getconfig(0x%02x) failed, result = %d\n",
2027 HFA384x_RID_CURRENTBSSID, result);
2028 return;
2031 result = hfa384x_drvr_getconfig(hw,
2032 HFA384x_RID_CURRENTSSID,
2033 &ssid, sizeof(ssid));
2034 if (result) {
2035 pr_debug("getconfig(0x%02x) failed, result = %d\n",
2036 HFA384x_RID_CURRENTSSID, result);
2037 return;
2039 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
2040 (p80211pstrd_t *) &wlandev->ssid);
2042 /* Reschedule timer */
2043 mod_timer(&hw->commsqual_timer, jiffies + HZ);
2046 void prism2sta_commsqual_timer(unsigned long data)
2048 hfa384x_t *hw = (hfa384x_t *) data;
2050 schedule_work(&hw->commsqual_bh);